0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-22 21:02:33 +01:00

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
This commit is contained in:
Kim Carlbäcker 2016-08-23 18:09:32 +02:00 committed by 无闻
parent 7f7216be6e
commit 7c5710d31f

View file

@ -161,6 +161,12 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
ctx.Error(500, "UpdateIssue", err) ctx.Error(500, "UpdateIssue", err)
return 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 // Refetch from database to assign some automatic values
issue, err = models.GetIssueByID(issue.ID) issue, err = models.GetIssueByID(issue.ID)