From 49e120a67c2d27597764eb260cdec07b5fd67fbb Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 8 Sep 2015 06:34:02 -0400 Subject: #1602 change status after comment issue --- routers/repo/issue.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'routers/repo/issue.go') diff --git a/routers/repo/issue.go b/routers/repo/issue.go index e821c130..019bb1d7 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())) } -- cgit v1.2.3 From 6f6f38e7c34baed7f0f6c5d9caf339ff8896dc6d Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 8 Sep 2015 09:09:40 -0400 Subject: #1603 suburl for comment attachments --- routers/repo/issue.go | 2 +- templates/repo/issue/view_content.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'routers/repo/issue.go') diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 019bb1d7..e242dd0e 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -819,7 +819,7 @@ func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) { ctx.Handle(500, "ChangeStatus", err) return } - log.Trace("%s Issue[%d] status changed: %v", ctx.Req.RequestURI, issue.ID, !issue.IsClosed) + log.Trace("Issue[%d] status changed: %v", issue.ID, !issue.IsClosed) } ctx.Redirect(fmt.Sprintf("%s/issues/%d#%s", ctx.Repo.RepoLink, issue.Index, comment.HashTag())) diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 41b46c58..d258d3d0 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -91,7 +91,7 @@
{{range .Attachments}} - + {{end}}
-- cgit v1.2.3