summaryrefslogtreecommitdiffstats
path: root/routers/api/v1
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-05-27 18:23:39 -0700
committerUnknwon <u@gogs.io>2016-05-27 18:23:39 -0700
commite9ae926e040c94ce66666ae6c330c93918fa321c (patch)
treee67748f36b0a13a45a374e69258dc6f178c0c5a5 /routers/api/v1
parent28c03f1147e4f3fbeaac7711d6f2adb5d7532c0a (diff)
downloadgitea-e9ae926e040c94ce66666ae6c330c93918fa321c.tar.gz
gitea-e9ae926e040c94ce66666ae6c330c93918fa321c.zip
#809 fix wrong closed issue count when create closed issue via API
Add start count corrector for Repository.NumClosedIssues
Diffstat (limited to 'routers/api/v1')
-rw-r--r--routers/api/v1/repo/issue.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 8c9336ba9c..a80adbc356 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -57,7 +57,6 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
PosterID: ctx.User.Id,
Poster: ctx.User,
Content: form.Body,
- IsClosed: form.Closed,
}
if ctx.Repo.IsWriter() {
@@ -86,6 +85,13 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
return
}
+ if form.Closed {
+ if err := issue.ChangeStatus(ctx.User, ctx.Repo.Repository, true); err != nil {
+ ctx.Error(500, "issue.ChangeStatus", err)
+ return
+ }
+ }
+
// Refetch from database to assign some automatic values
var err error
issue, err = models.GetIssueByID(issue.ID)