diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-07-19 05:51:33 +0800 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-07-18 22:51:33 +0100 |
commit | e0d6d2f97816f972d408308c740bacc450584e00 (patch) | |
tree | e68026c89e9a2c3bded17f45e24a459bf6b266f0 /models/issue_comment.go | |
parent | f9d6e35a8ad0a3bbf1a9f9732f192a3588f95c3b (diff) | |
download | gitea-e0d6d2f97816f972d408308c740bacc450584e00.tar.gz gitea-e0d6d2f97816f972d408308c740bacc450584e00.zip |
Fix repository's pull request count error (#7518)
* fix pr count error
* fix tests
Diffstat (limited to 'models/issue_comment.go')
-rw-r--r-- | models/issue_comment.go | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go index b930b0b12a..5e7ebc0cf3 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -634,12 +634,7 @@ func sendCreateCommentAction(e *xorm.Session, opts *CreateCommentOptions, commen act.OpType = ActionReopenPullRequest } - if opts.Issue.IsPull { - _, err = e.Exec("UPDATE `repository` SET num_closed_pulls=num_closed_pulls-1 WHERE id=?", opts.Repo.ID) - } else { - _, err = e.Exec("UPDATE `repository` SET num_closed_issues=num_closed_issues-1 WHERE id=?", opts.Repo.ID) - } - if err != nil { + if err = opts.Issue.updateClosedNum(e); err != nil { return err } @@ -649,12 +644,7 @@ func sendCreateCommentAction(e *xorm.Session, opts *CreateCommentOptions, commen act.OpType = ActionClosePullRequest } - if opts.Issue.IsPull { - _, err = e.Exec("UPDATE `repository` SET num_closed_pulls=num_closed_pulls+1 WHERE id=?", opts.Repo.ID) - } else { - _, err = e.Exec("UPDATE `repository` SET num_closed_issues=num_closed_issues+1 WHERE id=?", opts.Repo.ID) - } - if err != nil { + if err = opts.Issue.updateClosedNum(e); err != nil { return err } } |