diff options
author | guillep2k <18600385+guillep2k@users.noreply.github.com> | 2019-11-18 20:43:03 -0300 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-11-19 01:43:03 +0200 |
commit | 2c2b9718e6f13dfa14b0ff8aafb15cfa1d85bc0e (patch) | |
tree | 154ad04abab829611351291ad73e86975dbe7f6a /models/issue_comment.go | |
parent | f128e06ea608f07f279baa5c3e934b020fa57682 (diff) | |
download | gitea-2c2b9718e6f13dfa14b0ff8aafb15cfa1d85bc0e.tar.gz gitea-2c2b9718e6f13dfa14b0ff8aafb15cfa1d85bc0e.zip |
Avoid re-issuing redundant cross-references. (#8734)
* Avoid re-issuing redundant cross-references.
* Remove unused func; fix lint
* Simplify code as suggested by @laftriks
* Update test
Diffstat (limited to 'models/issue_comment.go')
-rw-r--r-- | models/issue_comment.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go index 7ac8c4df43..73fd9c8c83 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -545,7 +545,7 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err } } - if err = comment.addCrossReferences(e, opts.Doer); err != nil { + if err = comment.addCrossReferences(e, opts.Doer, false); err != nil { return nil, err } @@ -882,10 +882,7 @@ func UpdateComment(c *Comment, doer *User) error { if err := c.loadIssue(sess); err != nil { return err } - if err := c.neuterCrossReferences(sess); err != nil { - return err - } - if err := c.addCrossReferences(sess, doer); err != nil { + if err := c.addCrossReferences(sess, doer, true); err != nil { return err } if err := sess.Commit(); err != nil { |