aboutsummaryrefslogtreecommitdiff
path: root/routers/repo
diff options
context:
space:
mode:
authorRaphael Randschau <nicolai86@me.com>2015-02-23 20:32:44 +0100
committerRaphael Randschau <nicolai86@me.com>2015-02-23 21:26:24 +0100
commit1f61340fa3b255661e3b19432ab0af5162642139 (patch)
tree6f8efa5381cef3652044f19522f0d441a5afea5b /routers/repo
parentcd8b43d9844cb0de3ef7887178140f1dc43ec72c (diff)
Properly calculate the number of open issues per label
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/issue.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 3e0206da..722bd0c3 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -549,6 +549,7 @@ func UpdateIssueLabel(ctx *middleware.Context) {
label.NumClosedIssues--
}
}
+
if err = models.UpdateLabel(label); err != nil {
ctx.Handle(500, "issue.UpdateIssueLabel(UpdateLabel)", err)
return
@@ -767,6 +768,24 @@ func Comment(ctx *middleware.Context) {
return
}
+ if err = issue.GetLabels(); err != nil {
+ send(500, nil, err)
+ return
+ }
+
+ for _, label := range issue.Labels {
+ if issue.IsClosed {
+ label.NumClosedIssues++
+ } else {
+ label.NumClosedIssues--
+ }
+
+ if err = models.UpdateLabel(label); err != nil {
+ send(500, nil, err)
+ return
+ }
+ }
+
// Change open/closed issue counter for the associated milestone
if issue.MilestoneId > 0 {
if err = models.ChangeMilestoneIssueStats(issue); err != nil {