aboutsummaryrefslogtreecommitdiffstats
path: root/services/pull/review.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/pull/review.go')
-rw-r--r--services/pull/review.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/services/pull/review.go b/services/pull/review.go
index 22e0ae9853..8d8903c6a9 100644
--- a/services/pull/review.go
+++ b/services/pull/review.go
@@ -20,6 +20,7 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/util"
)
// CreateCodeComment creates a comment on the code line
@@ -271,7 +272,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, repoID 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, dismissPriors bool) (comment *issues_model.Comment, err error) {
review, err := issues_model.GetReviewByID(ctx, reviewID)
if err != nil {
return
@@ -295,6 +296,22 @@ func DismissReview(ctx context.Context, reviewID, repoID int64, message string,
return
}
+ if dismissPriors {
+ reviews, err := issues_model.GetReviews(ctx, &issues_model.GetReviewOptions{
+ IssueID: review.IssueID,
+ ReviewerID: review.ReviewerID,
+ Dismissed: util.OptionalBoolFalse,
+ })
+ if err != nil {
+ return nil, err
+ }
+ for _, oldReview := range reviews {
+ if err = issues_model.DismissReview(oldReview, true); err != nil {
+ return nil, err
+ }
+ }
+ }
+
if !isDismiss {
return nil, nil
}