From e9ae926e040c94ce66666ae6c330c93918fa321c Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 27 May 2016 18:23:39 -0700 Subject: #809 fix wrong closed issue count when create closed issue via API Add start count corrector for Repository.NumClosedIssues --- routers/api/v1/repo/issue.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'routers') 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) -- cgit v1.2.3