1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

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

Resolves #30675.
This commit is contained in:
Kemal Zebari
2024-04-27 04:55:03 -07:00
committed by GitHub
parent 238eb3ff9f
commit dd301cae1c
5 changed files with 119 additions and 14 deletions

View File

@@ -264,6 +264,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)
}