diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-12-01 10:44:39 +0800 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-11-30 21:44:39 -0500 |
commit | 2011a5b8183fe227f9f57f861dbe42abbd7abf42 (patch) | |
tree | cc34a5a20b3d8851f4dd139ce3a8356817883e1b /models/issue_label.go | |
parent | 7c6f2e27becb7ab43fe266d2882a0d80977c2ef7 (diff) | |
download | gitea-2011a5b8183fe227f9f57f861dbe42abbd7abf42.tar.gz gitea-2011a5b8183fe227f9f57f861dbe42abbd7abf42.zip |
Extract createComment (#9125)
* Extract createComment
* fix lint
* fix lint
Diffstat (limited to 'models/issue_label.go')
-rw-r--r-- | models/issue_label.go | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/models/issue_label.go b/models/issue_label.go index ef1f37d775..b2dd106176 100644 --- a/models/issue_label.go +++ b/models/issue_label.go @@ -406,14 +406,19 @@ func newIssueLabel(e *xorm.Session, issue *Issue, label *Label, doer *User) (err return } - if _, err = createComment(e, &CreateCommentOptions{ + var opts = &CreateCommentOptions{ Type: CommentTypeLabel, Doer: doer, Repo: issue.Repo, Issue: issue, Label: label, Content: "1", - }); err != nil { + } + comment, err := createCommentWithNoAction(e, opts) + if err != nil { + return err + } + if err = sendCreateCommentAction(e, opts, comment); err != nil { return err } @@ -482,13 +487,18 @@ func deleteIssueLabel(e *xorm.Session, issue *Issue, label *Label, doer *User) ( return } - if _, err = createComment(e, &CreateCommentOptions{ + var opts = &CreateCommentOptions{ Type: CommentTypeLabel, Doer: doer, Repo: issue.Repo, Issue: issue, Label: label, - }); err != nil { + } + comment, err := createCommentWithNoAction(e, opts) + if err != nil { + return err + } + if err = sendCreateCommentAction(e, opts, comment); err != nil { return err } |