diff options
author | Caesar Schinas <caesar@caesarschinas.com> | 2024-08-09 17:32:44 +0200 |
---|---|---|
committer | Caesar Schinas <caesar@caesarschinas.com> | 2024-08-12 13:24:52 +0200 |
commit | 65c2595f266060a2efc8ec4541c48ea61da2036e (patch) | |
tree | 1585954a84e93be0593f5f5a0bc7daccb4cc864c /routers | |
parent | Merge pull request '[PORT] Add warning message in merge instructions when `Au... (diff) | |
download | forgejo-65c2595f266060a2efc8ec4541c48ea61da2036e.tar.xz forgejo-65c2595f266060a2efc8ec4541c48ea61da2036e.zip |
Revert "Prevent allow/reject reviews on merged/closed PRs"
This reverts commit 4ed372af13a10e5a45464ac38f16c634707267c4.
This change from Gitea was not considered by the Forgejo UI team and there is a consensus that it feels like a regression.
The test which was added in that commit is kept and modified to test that reviews can successfully be submitted on closed and merged PRs.
Closes forgejo/design#11
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/pull_review.go | 13 | ||||
-rw-r--r-- | routers/web/repo/pull_review.go | 2 |
2 files changed, 2 insertions, 13 deletions
diff --git a/routers/api/v1/repo/pull_review.go b/routers/api/v1/repo/pull_review.go index 6799e43c73..39e1d487fa 100644 --- a/routers/api/v1/repo/pull_review.go +++ b/routers/api/v1/repo/pull_review.go @@ -4,7 +4,6 @@ package repo import ( - "errors" "fmt" "net/http" "strings" @@ -520,11 +519,7 @@ func CreatePullReview(ctx *context.APIContext) { // create review and associate all pending review comments review, _, err := pull_service.SubmitReview(ctx, ctx.Doer, ctx.Repo.GitRepo, pr.Issue, reviewType, opts.Body, opts.CommitID, nil) if err != nil { - if errors.Is(err, pull_service.ErrSubmitReviewOnClosedPR) { - ctx.Error(http.StatusUnprocessableEntity, "", err) - } else { - ctx.Error(http.StatusInternalServerError, "SubmitReview", err) - } + ctx.Error(http.StatusInternalServerError, "SubmitReview", err) return } @@ -612,11 +607,7 @@ func SubmitPullReview(ctx *context.APIContext) { // create review and associate all pending review comments review, _, err = pull_service.SubmitReview(ctx, ctx.Doer, ctx.Repo.GitRepo, pr.Issue, reviewType, opts.Body, headCommitID, nil) if err != nil { - if errors.Is(err, pull_service.ErrSubmitReviewOnClosedPR) { - ctx.Error(http.StatusUnprocessableEntity, "", err) - } else { - ctx.Error(http.StatusInternalServerError, "SubmitReview", err) - } + ctx.Error(http.StatusInternalServerError, "SubmitReview", err) return } diff --git a/routers/web/repo/pull_review.go b/routers/web/repo/pull_review.go index 24763668d0..e8a3c48d7f 100644 --- a/routers/web/repo/pull_review.go +++ b/routers/web/repo/pull_review.go @@ -248,8 +248,6 @@ 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) } |