summaryrefslogtreecommitdiffstats
path: root/routers/api/v1
diff options
context:
space:
mode:
authorLanre Adelowo <adelowomailbox@gmail.com>2019-02-18 21:55:04 +0100
committerLauris BH <lauris@nix.lv>2019-02-18 22:55:04 +0200
commit44114b38e601c8bf44f575daef1d0e0597f37d1d (patch)
treed2d271b31bff505a09c2faf04d5fea69a9f9d58c /routers/api/v1
parent64ce159a6eacc81962d07a8f5ef7f69c17365363 (diff)
downloadgitea-44114b38e601c8bf44f575daef1d0e0597f37d1d.tar.gz
gitea-44114b38e601c8bf44f575daef1d0e0597f37d1d.zip
Implement "conversation lock" for issue comments (#5073)
Diffstat (limited to 'routers/api/v1')
-rw-r--r--routers/api/v1/repo/issue_comment.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go
index 720513f007..3e6f04eb7a 100644
--- a/routers/api/v1/repo/issue_comment.go
+++ b/routers/api/v1/repo/issue_comment.go
@@ -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)