diff options
author | Unknwon <u@gogs.io> | 2016-05-27 18:23:39 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-05-27 18:23:39 -0700 |
commit | e9ae926e040c94ce66666ae6c330c93918fa321c (patch) | |
tree | e67748f36b0a13a45a374e69258dc6f178c0c5a5 /routers/api/v1 | |
parent | 28c03f1147e4f3fbeaac7711d6f2adb5d7532c0a (diff) | |
download | gitea-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.go | 8 |
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) |