@@ -640,6 +640,8 @@ func DeleteReviewRequests(ctx *context.APIContext) {
640
640
// "$ref": "#/responses/empty"
641
641
// "422":
642
642
// "$ref": "#/responses/validationError"
643
+ // "403":
644
+ // "$ref": "#/responses/forbidden"
643
645
// "404":
644
646
// "$ref": "#/responses/notFound"
645
647
opts := web .GetForm (ctx ).(* api.PullReviewRequestOptions )
@@ -708,6 +710,10 @@ func apiReviewRequest(ctx *context.APIContext, opts api.PullReviewRequestOptions
708
710
for _ , reviewer := range reviewers {
709
711
comment , err := issue_service .ReviewRequest (ctx , pr .Issue , ctx .Doer , reviewer , isAdd )
710
712
if err != nil {
713
+ if issues_model .IsErrReviewRequestOnClosedPR (err ) {
714
+ ctx .Error (http .StatusForbidden , "" , err )
715
+ return
716
+ }
711
717
ctx .Error (http .StatusInternalServerError , "ReviewRequest" , err )
712
718
return
713
719
}
@@ -874,7 +880,7 @@ func dismissReview(ctx *context.APIContext, msg string, isDismiss, dismissPriors
874
880
ctx .Error (http .StatusForbidden , "" , "Must be repo admin" )
875
881
return
876
882
}
877
- review , pr , isWrong := prepareSingleReview (ctx )
883
+ review , _ , isWrong := prepareSingleReview (ctx )
878
884
if isWrong {
879
885
return
880
886
}
@@ -884,13 +890,12 @@ func dismissReview(ctx *context.APIContext, msg string, isDismiss, dismissPriors
884
890
return
885
891
}
886
892
887
- if pr .Issue .IsClosed {
888
- ctx .Error (http .StatusForbidden , "" , "not need to dismiss this review because this pr is closed" )
889
- return
890
- }
891
-
892
893
_ , err := pull_service .DismissReview (ctx , review .ID , ctx .Repo .Repository .ID , msg , ctx .Doer , isDismiss , dismissPriors )
893
894
if err != nil {
895
+ if pull_service .IsErrDismissRequestOnClosedPR (err ) {
896
+ ctx .Error (http .StatusForbidden , "" , err )
897
+ return
898
+ }
894
899
ctx .Error (http .StatusInternalServerError , "pull_service.DismissReview" , err )
895
900
return
896
901
}
0 commit comments