summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-09-08 06:34:02 -0400
committerUnknwon <u@gogs.io>2015-09-08 06:34:02 -0400
commit49e120a67c2d27597764eb260cdec07b5fd67fbb (patch)
treed6253f1b553b009c3b785673fa01c681d882d466
parentaf324a6165a19269f6046b8ff489e65530083564 (diff)
downloadgitea-49e120a67c2d27597764eb260cdec07b5fd67fbb.tar.gz
gitea-49e120a67c2d27597764eb260cdec07b5fd67fbb.zip
#1602 change status after comment issue
-rw-r--r--models/issue.go2
-rw-r--r--routers/repo/issue.go26
2 files changed, 14 insertions, 14 deletions
diff --git a/models/issue.go b/models/issue.go
index dbc63b9574..00db990d8f 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -758,7 +758,7 @@ func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPul
queryStr := "SELECT COUNT(*) FROM `issue` "
baseCond := " WHERE issue.is_closed=?"
- if repoID > 0 {
+ if repoID > 0 || len(repoIDs) == 0 {
baseCond += " AND issue.repo_id=" + com.ToStr(repoID)
} else {
baseCond += " AND issue.repo_id IN (" + strings.Join(base.Int64sToStrings(repoIDs), ",") + ")"
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index e821c130c4..019bb1d750 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -759,18 +759,6 @@ func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) {
return
}
- // Check if issue owner/poster changes the status of issue.
- if (ctx.Repo.IsOwner() || (ctx.IsSigned && issue.IsPoster(ctx.User.Id))) &&
- (form.Status == "reopen" || form.Status == "close") &&
- !(issue.IsPull && issue.HasMerged) {
- issue.Repo = ctx.Repo.Repository
- if err = issue.ChangeStatus(ctx.User, form.Status == "close"); err != nil {
- ctx.Handle(500, "ChangeStatus", err)
- return
- }
- log.Trace("%s Issue[%d] status changed: %v", ctx.Req.RequestURI, issue.ID, !issue.IsClosed)
- }
-
// Fix #321: Allow empty comments, as long as we have attachments.
if len(form.Content) == 0 && len(attachments) == 0 {
ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, issue.Index))
@@ -820,8 +808,20 @@ func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) {
return
}
}
-
log.Trace("Comment created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, comment.ID)
+
+ // Check if issue owner/poster changes the status of issue.
+ if (ctx.Repo.IsOwner() || (ctx.IsSigned && issue.IsPoster(ctx.User.Id))) &&
+ (form.Status == "reopen" || form.Status == "close") &&
+ !(issue.IsPull && issue.HasMerged) {
+ issue.Repo = ctx.Repo.Repository
+ if err = issue.ChangeStatus(ctx.User, form.Status == "close"); err != nil {
+ ctx.Handle(500, "ChangeStatus", err)
+ return
+ }
+ log.Trace("%s Issue[%d] status changed: %v", ctx.Req.RequestURI, issue.ID, !issue.IsClosed)
+ }
+
ctx.Redirect(fmt.Sprintf("%s/issues/%d#%s", ctx.Repo.RepoLink, issue.Index, comment.HashTag()))
}