aboutsummaryrefslogtreecommitdiffstats
path: root/models/issue.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-06-21 20:34:58 +0200
committerGitHub <noreply@github.com>2021-06-21 14:34:58 -0400
commit36c158bc9375d7ebb9aa749ccd6718d0d68e96d2 (patch)
treebd89ab2d689395a33b45eda3102fb8e5e1c3c8e9 /models/issue.go
parent6a083a7234190d078ac51878bb8f39aa53ef1974 (diff)
downloadgitea-36c158bc9375d7ebb9aa749ccd6718d0d68e96d2.tar.gz
gitea-36c158bc9375d7ebb9aa749ccd6718d0d68e96d2.zip
Update milestone counters on new issue. (#16183)
Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models/issue.go')
-rw-r--r--models/issue.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/models/issue.go b/models/issue.go
index ffbc110a6b..b9643ae00e 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -647,8 +647,10 @@ func (issue *Issue) doChangeStatus(e *xorm.Session, doer *User, isMergePull bool
}
// Update issue count of milestone
- if err := updateMilestoneClosedNum(e, issue.MilestoneID); err != nil {
- return nil, err
+ if issue.MilestoneID > 0 {
+ if err := updateMilestoneCounters(e, issue.MilestoneID); err != nil {
+ return nil, err
+ }
}
if err := issue.updateClosedNum(e); err != nil {
@@ -907,7 +909,7 @@ func newIssue(e *xorm.Session, doer *User, opts NewIssueOptions) (err error) {
}
if opts.Issue.MilestoneID > 0 {
- if _, err = e.Exec("UPDATE `milestone` SET num_issues=num_issues+1 WHERE id=?", opts.Issue.MilestoneID); err != nil {
+ if err := updateMilestoneCounters(e, opts.Issue.MilestoneID); err != nil {
return err
}