Implement "conversation lock" for issue comments (#5073)

This commit is contained in:
Lanre Adelowo 2019-02-18 21:55:04 +01:00 committed by Lauris BH
parent 64ce159a6e
commit 44114b38e6
19 changed files with 435 additions and 4 deletions

View file

@ -5,6 +5,7 @@
package repo
import (
"errors"
"time"
"code.gitea.io/gitea/models"
@ -169,6 +170,11 @@ func CreateIssueComment(ctx *context.APIContext, form api.CreateIssueCommentOpti
return
}
if issue.IsLocked && !ctx.Repo.CanWrite(models.UnitTypeIssues) && !ctx.User.IsAdmin {
ctx.Error(403, "CreateIssueComment", errors.New(ctx.Tr("repo.issues.comment_on_locked")))
return
}
comment, err := models.CreateIssueComment(ctx.User, ctx.Repo.Repository, issue, form.Body, nil)
if err != nil {
ctx.Error(500, "CreateIssueComment", err)