1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-29 09:31:11 -05:00

Merge pull request #301 from nuss-justin/bugfix/milestone-counter

Update milestone issue stats when reopening/closing issue
This commit is contained in:
无闻 2014-07-22 16:46:20 -04:00
commit 6e9f1c52b1

View file

@ -642,6 +642,29 @@ func Comment(ctx *middleware.Context, params martini.Params) {
return return
} }
// Change open/closed issue counter for the associated milestone
if issue.MilestoneId > 0 {
l, err := models.GetMilestoneById(issue.MilestoneId)
if err != nil {
ctx.Handle(500, "issue.Comment(GetLabelById)", err)
return
}
if issue.IsClosed {
l.NumOpenIssues = l.NumOpenIssues - 1
l.NumClosedIssues = l.NumClosedIssues + 1
} else {
l.NumOpenIssues = l.NumOpenIssues + 1
l.NumClosedIssues = l.NumClosedIssues - 1
}
if err = models.UpdateMilestone(l); err != nil {
ctx.Handle(500, "issue.Comment(UpdateLabel)", err)
return
}
}
cmtType := models.IT_CLOSE cmtType := models.IT_CLOSE
if !issue.IsClosed { if !issue.IsClosed {
cmtType = models.IT_REOPEN cmtType = models.IT_REOPEN