summaryrefslogtreecommitdiffstats
path: root/services/pull/review.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/pull/review.go')
-rw-r--r--services/pull/review.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/services/pull/review.go b/services/pull/review.go
index 6bb8877b0f..22e0ae9853 100644
--- a/services/pull/review.go
+++ b/services/pull/review.go
@@ -271,7 +271,7 @@ func SubmitReview(ctx context.Context, doer *user_model.User, gitRepo *git.Repos
}
// DismissReview dismissing stale review by repo admin
-func DismissReview(ctx context.Context, reviewID int64, message string, doer *user_model.User, isDismiss bool) (comment *issues_model.Comment, err error) {
+func DismissReview(ctx context.Context, reviewID, repoID int64, message string, doer *user_model.User, isDismiss bool) (comment *issues_model.Comment, err error) {
review, err := issues_model.GetReviewByID(ctx, reviewID)
if err != nil {
return
@@ -281,6 +281,16 @@ func DismissReview(ctx context.Context, reviewID int64, message string, doer *us
return nil, fmt.Errorf("not need to dismiss this review because it's type is not Approve or change request")
}
+ // load data for notify
+ if err = review.LoadAttributes(ctx); err != nil {
+ return nil, err
+ }
+
+ // Check if the review's repoID is the one we're currently expecting.
+ if review.Issue.RepoID != repoID {
+ return nil, fmt.Errorf("reviews's repository is not the same as the one we expect")
+ }
+
if err = issues_model.DismissReview(review, isDismiss); err != nil {
return
}
@@ -289,10 +299,6 @@ func DismissReview(ctx context.Context, reviewID int64, message string, doer *us
return nil, nil
}
- // load data for notify
- if err = review.LoadAttributes(ctx); err != nil {
- return
- }
if err = review.Issue.LoadPullRequest(); err != nil {
return
}