summaryrefslogtreecommitdiffstats
path: root/models/review.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-04-15 11:03:11 +0100
committerGitHub <noreply@github.com>2021-04-15 11:03:11 +0100
commit9d07facdebffdd686108ad3b86641b85289d024b (patch)
treeb3fa21ab77cc348d5c09f03232dd362a9be99dc0 /models/review.go
parent61bae620c14b311ab77462b1356557f000a28ce1 (diff)
downloadgitea-9d07facdebffdd686108ad3b86641b85289d024b.tar.gz
gitea-9d07facdebffdd686108ad3b86641b85289d024b.zip
Ensure review dismissal only dismisses the correct review (#15477)
Fix #15472 Signed-off-by: Andrew Thornton art27@cantab.net
Diffstat (limited to 'models/review.go')
-rw-r--r--models/review.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/models/review.go b/models/review.go
index 702e9634ef..343621c0fa 100644
--- a/models/review.go
+++ b/models/review.go
@@ -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
}