summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorZettat123 <zettat123@gmail.com>2024-02-22 10:32:54 +0800
committerGitHub <noreply@github.com>2024-02-22 03:32:54 +0100
commitdcb9c38568dc4e9502fc416de237cce0eac41cba (patch)
tree8b95faeb72a9ebe6887f570c1ebce4d60cc8f621 /routers
parentc4a86b20a4ecef749caed4e9e1381c1736cb0309 (diff)
downloadgitea-dcb9c38568dc4e9502fc416de237cce0eac41cba.tar.gz
gitea-dcb9c38568dc4e9502fc416de237cce0eac41cba.zip
Fix error display when merging PRs (#29288) (#29309)
Backport #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
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/pull.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index 7b86c86188..70bbfeaca9 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -1266,19 +1266,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)