Ensure review dismissal only dismisses the correct review (#15477)

Fix #15472

Signed-off-by: Andrew Thornton art27@cantab.net
This commit is contained in:
zeripath 2021-04-15 11:03:11 +01:00 committed by GitHub
parent 61bae620c1
commit 9d07facdeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 8 deletions

View file

@ -566,7 +566,11 @@ func DismissReview(review *Review, isDismiss bool) (err error) {
review.Dismissed = isDismiss
_, err = x.Cols("dismissed").Update(review)
if review.ID == 0 {
return ErrReviewNotExist{}
}
_, err = x.ID(review.ID).Cols("dismissed").Update(review)
return
}