summaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorKim Carlbäcker <kim.carlbacker@gmail.com>2016-08-23 18:09:32 +0200
committer无闻 <u@gogs.io>2016-08-23 09:09:32 -0700
commit7c5710d31f49b86c458cb6570586cfc6627a790b (patch)
treef51165f0552448971f33d54e83fe9f67eddffe86 /routers/api
parent7f7216be6e4a55af83a614fb2782d643af40825a (diff)
downloadgitea-7c5710d31f49b86c458cb6570586cfc6627a790b.tar.gz
gitea-7c5710d31f49b86c458cb6570586cfc6627a790b.zip
Issues can be closed via API (#3170) (#3479)
* Issues can be closed via API * Error-checking is nice xD * EditIssueOption.Status => State * Use const instead of string-literal
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/issue.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 0d5ba756bb..2d37a5d0ef 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -161,6 +161,12 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
ctx.Error(500, "UpdateIssue", err)
return
}
+ if form.State != nil {
+ if err = issue.ChangeStatus(ctx.User, ctx.Repo.Repository, api.STATE_CLOSED == api.StateType(*form.State)); err != nil {
+ ctx.Error(500, "ChangeStatus", err)
+ return
+ }
+ }
// Refetch from database to assign some automatic values
issue, err = models.GetIssueByID(issue.ID)