diff options
author | Zettat123 <zettat123@gmail.com> | 2024-02-21 19:40:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-21 19:40:46 +0800 |
commit | 79217ea63c1f77de7ca79813ae45950724e63d02 (patch) | |
tree | 0686e0c355f73a92e6a8c1cd5390d34430f9caf2 | |
parent | 6130522aa86316c7d87e130cc8c440fd06920928 (diff) | |
download | gitea-79217ea63c1f77de7ca79813ae45950724e63d02.tar.gz gitea-79217ea63c1f77de7ca79813ae45950724e63d02.zip |
Fix error display when merging PRs (#29288)
Partially fix #29071, regression of Modernize merge button #28140
Fix some missing `Redirect` -> `JSONRedirect`.
Thanks @yp05327 for the help in
https://github.com/go-gitea/gitea/issues/29071#issuecomment-1931261075
-rw-r--r-- | routers/web/repo/pull.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index 7052467e64..b9a4aff02e 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -1283,19 +1283,19 @@ func MergePullRequest(ctx *context.Context) { return } ctx.Flash.Error(flashError) - ctx.Redirect(issue.Link()) + ctx.JSONRedirect(issue.Link()) } else if models.IsErrMergeUnrelatedHistories(err) { log.Debug("MergeUnrelatedHistories error: %v", err) ctx.Flash.Error(ctx.Tr("repo.pulls.unrelated_histories")) - ctx.Redirect(issue.Link()) + ctx.JSONRedirect(issue.Link()) } else if git.IsErrPushOutOfDate(err) { log.Debug("MergePushOutOfDate error: %v", err) ctx.Flash.Error(ctx.Tr("repo.pulls.merge_out_of_date")) - ctx.Redirect(issue.Link()) + ctx.JSONRedirect(issue.Link()) } else if models.IsErrSHADoesNotMatch(err) { log.Debug("MergeHeadOutOfDate error: %v", err) ctx.Flash.Error(ctx.Tr("repo.pulls.head_out_of_date")) - ctx.Redirect(issue.Link()) + ctx.JSONRedirect(issue.Link()) } else if git.IsErrPushRejected(err) { log.Debug("MergePushRejected error: %v", err) pushrejErr := err.(*git.ErrPushRejected) |