aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo/issue.go
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/repo/issue.go
parent495d5e4329326b27158a25b44c37986923d0bb6b (diff)
downloadgitea-c66c9dabc7453febc0e01fcc974baf06fd96c38d.tar.gz
gitea-c66c9dabc7453febc0e01fcc974baf06fd96c38d.zip
Move issue change status from models to service (#8691)
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r--routers/repo/issue.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 4e755b7191..9c313e56d4 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -1185,7 +1185,7 @@ func UpdateIssueStatus(ctx *context.Context) {
}
for _, issue := range issues {
if issue.IsClosed != isClosed {
- if err := issue.ChangeStatus(ctx.User, isClosed); err != nil {
+ if err := issue_service.ChangeStatus(issue, ctx.User, isClosed); err != nil {
if models.IsErrDependenciesLeft(err) {
ctx.JSON(http.StatusPreconditionFailed, map[string]interface{}{
"error": "cannot close this issue because it still has open dependencies",
@@ -1195,8 +1195,6 @@ func UpdateIssueStatus(ctx *context.Context) {
ctx.ServerError("ChangeStatus", err)
return
}
-
- notification.NotifyIssueChangeStatus(ctx.User, issue, isClosed)
}
}
ctx.JSON(200, map[string]interface{}{
@@ -1286,7 +1284,7 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
ctx.Flash.Info(ctx.Tr("repo.pulls.open_unmerged_pull_exists", pr.Index))
} else {
isClosed := form.Status == "close"
- if err := issue.ChangeStatus(ctx.User, isClosed); err != nil {
+ if err := issue_service.ChangeStatus(issue, ctx.User, isClosed); err != nil {
log.Error("ChangeStatus: %v", err)
if models.IsErrDependenciesLeft(err) {
@@ -1300,15 +1298,12 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
return
}
} else {
-
if err := stopTimerIfAvailable(ctx.User, issue); err != nil {
ctx.ServerError("CreateOrStopIssueStopwatch", err)
return
}
log.Trace("Issue [%d] status changed to closed: %v", issue.ID, issue.IsClosed)
-
- notification.NotifyIssueChangeStatus(ctx.User, issue, isClosed)
}
}
}