Merge remote-tracking branch 'origin/master'

# Conflicts:
#	models/issue_dependency.go
This commit is contained in:
Konrad 2017-09-17 21:39:43 +02:00
commit d911fda62b
5 changed files with 11 additions and 10 deletions

View File

@ -275,7 +275,7 @@ func (c *Comment) LoadAssignees() error {
return nil return nil
} }
// Load Dependent Issue Details // LoadDepIssueDetails loads Dependent Issue Details
func (c *Comment) LoadDepIssueDetails() error { func (c *Comment) LoadDepIssueDetails() error {
var err error var err error
if c.DependentIssueID > 0 { if c.DependentIssueID > 0 {
@ -316,9 +316,9 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
LabelID = opts.Label.ID LabelID = opts.Label.ID
} }
var depId int64 = 0 var depID int64
if opts.DependentIssue != nil { if opts.DependentIssue != nil {
depId = opts.DependentIssue.ID depID = opts.DependentIssue.ID
} }
comment := &Comment{ comment := &Comment{
@ -338,7 +338,7 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
OldTitle: opts.OldTitle, OldTitle: opts.OldTitle,
NewTitle: opts.NewTitle, NewTitle: opts.NewTitle,
DependentIssue: opts.DependentIssue, DependentIssue: opts.DependentIssue,
DependentIssueID: depId, DependentIssueID: depID,
} }
//fmt.Println(comment) //fmt.Println(comment)

View File

@ -86,7 +86,7 @@ func CreateIssueDependency(user *User, issue, dep *Issue) (err error, exists boo
return nil, exists return nil, exists
} }
// Removes a dependency from an issue // RemoveIssueDependency removes a dependency from an issue
func RemoveIssueDependency(user *User, issue *Issue, dep *Issue, depType int64) (err error) { func RemoveIssueDependency(user *User, issue *Issue, dep *Issue, depType int64) (err error) {
sess := x.NewSession() sess := x.NewSession()
@ -153,7 +153,7 @@ func issueDepExists(e Engine, issueID int64, depID int64) (exists bool, err erro
return return
} }
// check if issue can be closed // IssueNoDependenciesLeft checks if issue can be closed
func IssueNoDependenciesLeft(issue *Issue) bool { func IssueNoDependenciesLeft(issue *Issue) bool {
var issueDeps []IssueDependency var issueDeps []IssueDependency

View File

@ -693,7 +693,7 @@ func (repo *Repository) getUsersWithAccessMode(e Engine, mode AccessMode) (_ []*
return users, nil return users, nil
} }
// Find all Dependencies an issue is blocked by // BlockedByDependencies finds all Dependencies an issue is blocked by
func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err error) { func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err error) {
issueDeps, err := repo.getBlockedByDependencies(x, issueID) issueDeps, err := repo.getBlockedByDependencies(x, issueID)
@ -711,6 +711,7 @@ func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err er
return issueDepsFull, nil return issueDepsFull, nil
} }
// BlockingDependencies returns all blocking dependencies
func (repo *Repository) BlockingDependencies(issueID int64) (_ []*Issue, err error) { func (repo *Repository) BlockingDependencies(issueID int64) (_ []*Issue, err error) {
issueDeps, err := repo.getBlockingDependencies(x, issueID) issueDeps, err := repo.getBlockingDependencies(x, issueID)

View File

@ -13,7 +13,7 @@ import (
"code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/context"
) )
// Adds new dependencies // AddDependency adds new dependencies
func AddDependency(c *context.Context) { func AddDependency(c *context.Context) {
// TODO: should should an issue only have dependencies in it's own repo? // TODO: should should an issue only have dependencies in it's own repo?
@ -49,7 +49,7 @@ func AddDependency(c *context.Context) {
c.Flash.Error(c.Tr("issues.dependency.add_error_same_issue")) c.Flash.Error(c.Tr("issues.dependency.add_error_same_issue"))
} else { } else {
err, exists, depExists := models.CreateIssueDependency(c.User, issue, dep) exists, depExists, err := models.CreateIssueDependency(c.User, issue, dep)
if err != nil { if err != nil {
c.Handle(http.StatusInternalServerError, "CreateOrUpdateIssueDependency", err) c.Handle(http.StatusInternalServerError, "CreateOrUpdateIssueDependency", err)
return return

View File

@ -13,7 +13,7 @@ import (
"code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/context"
) )
// IssueWatch sets issue watching // RemoveDependency removes the dependency
func RemoveDependency(c *context.Context) { func RemoveDependency(c *context.Context) {
depID, err := strconv.ParseInt(c.Req.PostForm.Get("removeDependencyID"), 10, 64) depID, err := strconv.ParseInt(c.Req.PostForm.Get("removeDependencyID"), 10, 64)
if err != nil { if err != nil {