diff --git a/models/issue_comment.go b/models/issue_comment.go index b0dd338bd..c1e2285fc 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -275,7 +275,7 @@ func (c *Comment) LoadAssignees() error { return nil } -// Load Dependent Issue Details +// LoadDepIssueDetails loads Dependent Issue Details func (c *Comment) LoadDepIssueDetails() error { var err error if c.DependentIssueID > 0 { @@ -316,9 +316,9 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err LabelID = opts.Label.ID } - var depId int64 = 0 + var depID int64 if opts.DependentIssue != nil { - depId = opts.DependentIssue.ID + depID = opts.DependentIssue.ID } comment := &Comment{ @@ -338,7 +338,7 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err OldTitle: opts.OldTitle, NewTitle: opts.NewTitle, DependentIssue: opts.DependentIssue, - DependentIssueID: depId, + DependentIssueID: depID, } //fmt.Println(comment) diff --git a/models/issue_dependency.go b/models/issue_dependency.go index 02d40ca38..2a190c97e 100644 --- a/models/issue_dependency.go +++ b/models/issue_dependency.go @@ -86,7 +86,7 @@ func CreateIssueDependency(user *User, issue, dep *Issue) (err error, exists boo 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) { sess := x.NewSession() @@ -153,7 +153,7 @@ func issueDepExists(e Engine, issueID int64, depID int64) (exists bool, err erro return } -// check if issue can be closed +// IssueNoDependenciesLeft checks if issue can be closed func IssueNoDependenciesLeft(issue *Issue) bool { var issueDeps []IssueDependency diff --git a/models/repo.go b/models/repo.go index be0916779..37ef57062 100644 --- a/models/repo.go +++ b/models/repo.go @@ -693,7 +693,7 @@ func (repo *Repository) getUsersWithAccessMode(e Engine, mode AccessMode) (_ []* 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) { issueDeps, err := repo.getBlockedByDependencies(x, issueID) @@ -711,6 +711,7 @@ func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err er return issueDepsFull, nil } +// BlockingDependencies returns all blocking dependencies func (repo *Repository) BlockingDependencies(issueID int64) (_ []*Issue, err error) { issueDeps, err := repo.getBlockingDependencies(x, issueID) diff --git a/routers/repo/issue_dependency_add.go b/routers/repo/issue_dependency_add.go index 630772a98..ee74401db 100644 --- a/routers/repo/issue_dependency_add.go +++ b/routers/repo/issue_dependency_add.go @@ -13,7 +13,7 @@ import ( "code.gitea.io/gitea/modules/context" ) -// Adds new dependencies +// AddDependency adds new dependencies func AddDependency(c *context.Context) { // 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")) } else { - err, exists, depExists := models.CreateIssueDependency(c.User, issue, dep) + exists, depExists, err := models.CreateIssueDependency(c.User, issue, dep) if err != nil { c.Handle(http.StatusInternalServerError, "CreateOrUpdateIssueDependency", err) return diff --git a/routers/repo/issue_dependency_remove.go b/routers/repo/issue_dependency_remove.go index f20eb94a4..7234564b0 100644 --- a/routers/repo/issue_dependency_remove.go +++ b/routers/repo/issue_dependency_remove.go @@ -13,7 +13,7 @@ import ( "code.gitea.io/gitea/modules/context" ) -// IssueWatch sets issue watching +// RemoveDependency removes the dependency func RemoveDependency(c *context.Context) { depID, err := strconv.ParseInt(c.Req.PostForm.Get("removeDependencyID"), 10, 64) if err != nil {