aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo/pull_review.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/pull_review.go')
-rw-r--r--routers/repo/pull_review.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/routers/repo/pull_review.go b/routers/repo/pull_review.go
index 1269a7a7e7..9d1db3ff4e 100644
--- a/routers/repo/pull_review.go
+++ b/routers/repo/pull_review.go
@@ -128,13 +128,23 @@ func SubmitReview(ctx *context.Context, form auth.SubmitReviewForm) {
}
}
- if form.HasEmptyContent() {
+ review, err = models.GetCurrentReview(ctx.User, issue)
+ if err == nil {
+ review.Issue = issue
+ if errl := review.LoadCodeComments(); errl != nil {
+ ctx.ServerError("LoadCodeComments", err)
+ return
+ }
+ }
+
+ if ((err == nil && len(review.CodeComments) == 0) ||
+ (err != nil && models.IsErrReviewNotExist(err))) &&
+ form.HasEmptyContent() {
ctx.Flash.Error(ctx.Tr("repo.issues.review.content.empty"))
ctx.Redirect(fmt.Sprintf("%s/pulls/%d/files", ctx.Repo.RepoLink, issue.Index))
return
}
- review, err = models.GetCurrentReview(ctx.User, issue)
if err != nil {
if !models.IsErrReviewNotExist(err) {
ctx.ServerError("GetCurrentReview", err)