Skip to content

Commit

Permalink
New review approvals shouldn't require a message (#8991)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
jolheiser authored and zeripath committed Nov 14, 2019
1 parent ae36ed7 commit 4b5ebb9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/review.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
}

Expand All @@ -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{}
}

Expand Down

0 comments on commit 4b5ebb9

Please sign in to comment.