From 4b5ebb93e48f04227ec18cf042e916df4eafe830 Mon Sep 17 00:00:00 2001 From: John Olheiser <42128690+jolheiser@users.noreply.github.com> Date: Thu, 14 Nov 2019 14:58:01 -0600 Subject: [PATCH] New review approvals shouldn't require a message (#8991) * New approvals don't require content Signed-off-by: jolheiser * Fix edge-bug Signed-off-by: jolheiser --- models/review.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/review.go b/models/review.go index 441bb40fbb..e1674e885d 100644 --- a/models/review.go +++ b/models/review.go @@ -254,7 +254,7 @@ func SubmitReview(doer *User, issue *Issue, reviewType ReviewType, content strin return nil, nil, err } - if len(strings.TrimSpace(content)) == 0 { + if reviewType != ReviewTypeApprove && len(strings.TrimSpace(content)) == 0 { return nil, nil, ContentEmptyErr{} } @@ -272,7 +272,7 @@ func SubmitReview(doer *User, issue *Issue, reviewType ReviewType, content strin if err := review.loadCodeComments(sess); err != nil { return nil, nil, err } - if len(review.CodeComments) == 0 && len(strings.TrimSpace(content)) == 0 { + if reviewType != ReviewTypeApprove && len(review.CodeComments) == 0 && len(strings.TrimSpace(content)) == 0 { return nil, nil, ContentEmptyErr{} }