forked from forgejo/forgejo
Move issue change status from models to service (#8691)
This commit is contained in:
parent
495d5e4329
commit
c66c9dabc7
6 changed files with 68 additions and 54 deletions
|
@ -448,7 +448,7 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
|
|||
return
|
||||
}
|
||||
if form.State != nil {
|
||||
if err = issue.ChangeStatus(ctx.User, api.StateClosed == api.StateType(*form.State)); err != nil {
|
||||
if err = issue_service.ChangeStatus(issue, ctx.User, api.StateClosed == api.StateType(*form.State)); err != nil {
|
||||
if models.IsErrDependenciesLeft(err) {
|
||||
ctx.Error(http.StatusPreconditionFailed, "DependenciesLeft", "cannot close this pull request because it still has open dependencies")
|
||||
return
|
||||
|
@ -456,8 +456,6 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
|
|||
ctx.Error(500, "ChangeStatus", err)
|
||||
return
|
||||
}
|
||||
|
||||
notification.NotifyIssueChangeStatus(ctx.User, issue, api.StateClosed == api.StateType(*form.State))
|
||||
}
|
||||
|
||||
// Refetch from database
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue