]> source.dussan.org Git - gitea.git/commitdiff
New review approvals shouldn't require a message (#8991)
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>
Thu, 14 Nov 2019 20:58:01 +0000 (14:58 -0600)
committerzeripath <art27@cantab.net>
Thu, 14 Nov 2019 20:58:01 +0000 (20:58 +0000)
* New approvals don't require content

Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix edge-bug

Signed-off-by: jolheiser <john.olheiser@gmail.com>
models/review.go

index 441bb40fbb85a5eb781e7d7f733305342adbabbf..e1674e885d00386a3b4b9cc7197c6016e8957127 100644 (file)
@@ -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{}
                }