Skip to content

Commit 9a63c6f

Browse files
Zettat123earl-warren
authored andcommitted
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 go-gitea/gitea#29071 (comment) (cherry picked from commit dcb9c38568dc4e9502fc416de237cce0eac41cba)
1 parent 47e70bb commit 9a63c6f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

routers/web/repo/pull.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,19 +1236,19 @@ func MergePullRequest(ctx *context.Context) {
12361236
return
12371237
}
12381238
ctx.Flash.Error(flashError)
1239-
ctx.Redirect(issue.Link())
1239+
ctx.JSONRedirect(issue.Link())
12401240
} else if models.IsErrMergeUnrelatedHistories(err) {
12411241
log.Debug("MergeUnrelatedHistories error: %v", err)
12421242
ctx.Flash.Error(ctx.Tr("repo.pulls.unrelated_histories"))
1243-
ctx.Redirect(issue.Link())
1243+
ctx.JSONRedirect(issue.Link())
12441244
} else if git.IsErrPushOutOfDate(err) {
12451245
log.Debug("MergePushOutOfDate error: %v", err)
12461246
ctx.Flash.Error(ctx.Tr("repo.pulls.merge_out_of_date"))
1247-
ctx.Redirect(issue.Link())
1247+
ctx.JSONRedirect(issue.Link())
12481248
} else if models.IsErrSHADoesNotMatch(err) {
12491249
log.Debug("MergeHeadOutOfDate error: %v", err)
12501250
ctx.Flash.Error(ctx.Tr("repo.pulls.head_out_of_date"))
1251-
ctx.Redirect(issue.Link())
1251+
ctx.JSONRedirect(issue.Link())
12521252
} else if git.IsErrPushRejected(err) {
12531253
log.Debug("MergePushRejected error: %v", err)
12541254
pushrejErr := err.(*git.ErrPushRejected)

0 commit comments

Comments
 (0)