summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-10-28 13:26:46 +0800
committerGitHub <noreply@github.com>2019-10-28 13:26:46 +0800
commitc66c9dabc7453febc0e01fcc974baf06fd96c38d (patch)
tree59709b9bd6c68cf4efaa5ed9b34a30cbde99d462 /routers/api/v1/repo
parent495d5e4329326b27158a25b44c37986923d0bb6b (diff)
downloadgitea-c66c9dabc7453febc0e01fcc974baf06fd96c38d.tar.gz
gitea-c66c9dabc7453febc0e01fcc974baf06fd96c38d.zip
Move issue change status from models to service (#8691)
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r--routers/api/v1/repo/issue.go6
-rw-r--r--routers/api/v1/repo/pull.go4
2 files changed, 3 insertions, 7 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index a41abba4cd..09a4e32d2f 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -254,7 +254,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
notification.NotifyNewIssue(issue)
if form.Closed {
- if err := issue.ChangeStatus(ctx.User, true); err != nil {
+ if err := issue_service.ChangeStatus(issue, ctx.User, true); err != nil {
if models.IsErrDependenciesLeft(err) {
ctx.Error(http.StatusPreconditionFailed, "DependenciesLeft", "cannot close this issue because it still has open dependencies")
return
@@ -381,7 +381,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
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 issue because it still has open dependencies")
return
@@ -389,8 +389,6 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
ctx.Error(500, "ChangeStatus", err)
return
}
-
- notification.NotifyIssueChangeStatus(ctx.User, issue, api.StateClosed == api.StateType(*form.State))
}
// Refetch from database to assign some automatic values
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 77fb452938..d4ce00fa12 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -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