Prevent allow/reject reviews on merged/closed PRs (#30686)

Resolves #30675.

(cherry picked from commit dd301cae1c40c9ef2805bd13af6b09a81ff4f5d7)

Conflicts:
	tests/integration/pull_review_test.go
	trivial context conflict in import
This commit is contained in:
Kemal Zebari 2024-04-27 04:55:03 -07:00 committed by Earl Warren
parent 8ee31a6ba3
commit 4ed372af13
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
5 changed files with 119 additions and 14 deletions

View file

@ -248,6 +248,8 @@ func SubmitReview(ctx *context.Context) {
if issues_model.IsContentEmptyErr(err) {
ctx.Flash.Error(ctx.Tr("repo.issues.review.content.empty"))
ctx.JSONRedirect(fmt.Sprintf("%s/pulls/%d/files", ctx.Repo.RepoLink, issue.Index))
} else if errors.Is(err, pull_service.ErrSubmitReviewOnClosedPR) {
ctx.Status(http.StatusUnprocessableEntity)
} else {
ctx.ServerError("SubmitReview", err)
}