diff options
author | Lanre Adelowo <adelowomailbox@gmail.com> | 2018-08-07 18:15:41 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-08-07 20:15:41 +0300 |
commit | 0df7cab4fb0c84444ceb4c9b5f28f410a38025f5 (patch) | |
tree | 4f5de68f3881caf4646e1a0d187a6ba7b2cebcf7 /routers | |
parent | 59b10e66f757441e8c74532f30740bf4a96e9ac1 (diff) | |
download | gitea-0df7cab4fb0c84444ceb4c9b5f28f410a38025f5.tar.gz gitea-0df7cab4fb0c84444ceb4c9b5f28f410a38025f5.zip |
prevent empty review comment (#4632)
* prevent empty review comment
This would only require a comment for rejection and comment
* add tests
* add comment
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/pull_review.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/routers/repo/pull_review.go b/routers/repo/pull_review.go index fa13cacfd3..7ca02ac809 100644 --- a/routers/repo/pull_review.go +++ b/routers/repo/pull_review.go @@ -107,6 +107,13 @@ func SubmitReview(ctx *context.Context, form auth.SubmitReviewForm) { ctx.ServerError("GetCurrentReview", fmt.Errorf("unknown ReviewType: %s", form.Type)) return } + + if form.HasEmptyContent() { + ctx.Flash.Error(ctx.Tr("repo.issues.review.content.empty")) + ctx.Redirect(fmt.Sprintf("%s/pulls/%d", ctx.Repo.RepoLink, issue.Index)) + return + } + review, err = models.GetCurrentReview(ctx.User, issue) if err != nil { if !models.IsErrReviewNotExist(err) { |