mirror of
https://github.com/go-gitea/gitea.git
synced 2024-10-30 08:27:32 -04:00
#1602 change status after comment issue
This commit is contained in:
parent
af324a6165
commit
49e120a67c
@ -758,7 +758,7 @@ func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPul
|
|||||||
|
|
||||||
queryStr := "SELECT COUNT(*) FROM `issue` "
|
queryStr := "SELECT COUNT(*) FROM `issue` "
|
||||||
baseCond := " WHERE issue.is_closed=?"
|
baseCond := " WHERE issue.is_closed=?"
|
||||||
if repoID > 0 {
|
if repoID > 0 || len(repoIDs) == 0 {
|
||||||
baseCond += " AND issue.repo_id=" + com.ToStr(repoID)
|
baseCond += " AND issue.repo_id=" + com.ToStr(repoID)
|
||||||
} else {
|
} else {
|
||||||
baseCond += " AND issue.repo_id IN (" + strings.Join(base.Int64sToStrings(repoIDs), ",") + ")"
|
baseCond += " AND issue.repo_id IN (" + strings.Join(base.Int64sToStrings(repoIDs), ",") + ")"
|
||||||
|
@ -759,18 +759,6 @@ func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) {
|
|||||||
return
|
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.
|
// Fix #321: Allow empty comments, as long as we have attachments.
|
||||||
if len(form.Content) == 0 && len(attachments) == 0 {
|
if len(form.Content) == 0 && len(attachments) == 0 {
|
||||||
ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, issue.Index))
|
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
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("Comment created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, comment.ID)
|
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()))
|
ctx.Redirect(fmt.Sprintf("%s/issues/%d#%s", ctx.Repo.RepoLink, issue.Index, comment.HashTag()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user