Skip to content

Commit

Permalink
Remove unused comment actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Dec 2, 2019
1 parent 2fc3eb1 commit 3ff9d59
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 43 deletions.
16 changes: 3 additions & 13 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,13 +721,10 @@ func (issue *Issue) ChangeTitle(doer *User, oldTitle string) (err error) {
OldTitle: oldTitle,
NewTitle: issue.Title,
}
comment, err := createCommentWithNoAction(sess, opts)
_, err = createCommentWithNoAction(sess, opts)
if err != nil {
return fmt.Errorf("createComment: %v", err)
}
if err = sendCreateCommentAction(sess, opts, comment); err != nil {
return err
}
if err = issue.addCrossReferences(sess, doer, true); err != nil {
return err
}
Expand All @@ -753,13 +750,10 @@ func AddDeletePRBranchComment(doer *User, repo *Repository, issueID int64, branc
Issue: issue,
CommitSHA: branchName,
}
comment, err := createCommentWithNoAction(sess, opts)
_, err = createCommentWithNoAction(sess, opts)
if err != nil {
return err
}
if err = sendCreateCommentAction(sess, opts, comment); err != nil {
return err
}

return sess.Commit()
}
Expand Down Expand Up @@ -899,14 +893,10 @@ func newIssue(e *xorm.Session, doer *User, opts NewIssueOptions) (err error) {
OldMilestoneID: 0,
MilestoneID: opts.Issue.MilestoneID,
}
comment, err := createCommentWithNoAction(e, opts)
_, err = createCommentWithNoAction(e, opts)
if err != nil {
return err
}

if err = sendCreateCommentAction(e, opts, comment); err != nil {
return err
}
}

if opts.IsPull {
Expand Down
3 changes: 0 additions & 3 deletions models/issue_assignees.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ func (issue *Issue) toggleAssignee(sess *xorm.Session, doer *User, assigneeID in
if err != nil {
return false, nil, fmt.Errorf("createComment: %v", err)
}
if err = sendCreateCommentAction(sess, opts, comment); err != nil {
return false, nil, err
}

// if pull request is in the middle of creation - don't call webhook
if isCreate {
Expand Down
12 changes: 3 additions & 9 deletions models/issue_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ func createDeadlineComment(e *xorm.Session, doer *User, issue *Issue, newDeadlin
if err != nil {
return nil, err
}
return comment, sendCreateCommentAction(e, opts, comment)
return comment, nil
}

// Creates issue dependency comment
Expand All @@ -699,13 +699,10 @@ func createIssueDependencyComment(e *xorm.Session, doer *User, issue *Issue, dep
Issue: issue,
DependentIssueID: dependentIssue.ID,
}
comment, err := createCommentWithNoAction(e, opts)
_, err = createCommentWithNoAction(e, opts)
if err != nil {
return
}
if err = sendCreateCommentAction(e, opts, comment); err != nil {
return err
}

opts = &CreateCommentOptions{
Type: cType,
Expand All @@ -714,13 +711,10 @@ func createIssueDependencyComment(e *xorm.Session, doer *User, issue *Issue, dep
Issue: dependentIssue,
DependentIssueID: issue.ID,
}
comment, err = createCommentWithNoAction(e, opts)
_, err = createCommentWithNoAction(e, opts)
if err != nil {
return
}
if err = sendCreateCommentAction(e, opts, comment); err != nil {
return err
}

return
}
Expand Down
10 changes: 2 additions & 8 deletions models/issue_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,13 +414,10 @@ func newIssueLabel(e *xorm.Session, issue *Issue, label *Label, doer *User) (err
Label: label,
Content: "1",
}
comment, err := createCommentWithNoAction(e, opts)
_, err = createCommentWithNoAction(e, opts)
if err != nil {
return err
}
if err = sendCreateCommentAction(e, opts, comment); err != nil {
return err
}

return updateLabel(e, label)
}
Expand Down Expand Up @@ -494,13 +491,10 @@ func deleteIssueLabel(e *xorm.Session, issue *Issue, label *Label, doer *User) (
Issue: issue,
Label: label,
}
comment, err := createCommentWithNoAction(e, opts)
_, err = createCommentWithNoAction(e, opts)
if err != nil {
return err
}
if err = sendCreateCommentAction(e, opts, comment); err != nil {
return err
}

return updateLabel(e, label)
}
Expand Down
6 changes: 1 addition & 5 deletions models/issue_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,10 @@ func updateIssueLock(opts *IssueLockOptions, lock bool) error {
Type: commentType,
Content: opts.Reason,
}
comment, err := createCommentWithNoAction(sess, opt)
_, err := createCommentWithNoAction(sess, opt)
if err != nil {
return err
}

if err = sendCreateCommentAction(sess, opt, comment); err != nil {
return err
}

return sess.Commit()
}
6 changes: 1 addition & 5 deletions models/issue_milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,10 @@ func changeMilestoneAssign(e *xorm.Session, doer *User, issue *Issue, oldMilesto
OldMilestoneID: oldMilestoneID,
MilestoneID: issue.MilestoneID,
}
comment, err := createCommentWithNoAction(e, opts)
_, err := createCommentWithNoAction(e, opts)
if err != nil {
return err
}

if err := sendCreateCommentAction(e, opts, comment); err != nil {
return err
}
}

return nil
Expand Down

0 comments on commit 3ff9d59

Please sign in to comment.