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
pull/197/head
Kim Carlbäcker 8 years ago committed by 无闻
parent 7f7216be6e
commit 7c5710d31f
  1. 6
      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)

Loading…
Cancel
Save