From a1e57ebe6b1cd42a18d34bf576f101f6889b0953 Mon Sep 17 00:00:00 2001 From: Jimmy Praet Date: Thu, 7 Oct 2021 23:58:13 +0200 Subject: [PATCH] Fix unwanted team review request deletion (#17257) (#17264) Add missing issue_id = ? to where clause Fixes #17251 --- models/review.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/review.go b/models/review.go index acb54d970f..165e67922b 100644 --- a/models/review.go +++ b/models/review.go @@ -434,7 +434,7 @@ func SubmitReview(doer *User, issue *Issue, reviewType ReviewType, content, comm // try to remove team review request if need if issue.Repo.Owner.IsOrganization() && (reviewType == ReviewTypeApprove || reviewType == ReviewTypeReject) { teamReviewRequests := make([]*Review, 0, 10) - if err := sess.SQL("SELECT * FROM review WHERE reviewer_team_id > 0 AND type = ?", ReviewTypeRequest).Find(&teamReviewRequests); err != nil { + if err := sess.SQL("SELECT * FROM review WHERE issue_id = ? AND reviewer_team_id > 0 AND type = ?", issue.ID, ReviewTypeRequest).Find(&teamReviewRequests); err != nil { return nil, nil, err } -- 2.39.5