From 3719f907009ac704f1a9efa95d7503642e1a07bb Mon Sep 17 00:00:00 2001 From: jolheiser Date: Thu, 14 Nov 2019 09:40:47 -0600 Subject: [PATCH 1/2] New approvals don't require content Signed-off-by: jolheiser --- models/review.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/review.go b/models/review.go index 441bb40fbb85a..423f9e4927b8e 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{} } From bf694e321e8491a53a032334c972a49cbf0c2290 Mon Sep 17 00:00:00 2001 From: jolheiser Date: Thu, 14 Nov 2019 12:48:59 -0600 Subject: [PATCH 2/2] Fix edge-bug Signed-off-by: jolheiser --- models/review.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/review.go b/models/review.go index 423f9e4927b8e..e1674e885d003 100644 --- a/models/review.go +++ b/models/review.go @@ -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{} }