Skip to content

Commit 79217ea

Browse files
authored
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 #29071 (comment)
1 parent 6130522 commit 79217ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

routers/web/repo/pull.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1283,19 +1283,19 @@ func MergePullRequest(ctx *context.Context) {
12831283
return
12841284
}
12851285
ctx.Flash.Error(flashError)
1286-
ctx.Redirect(issue.Link())
1286+
ctx.JSONRedirect(issue.Link())
12871287
} else if models.IsErrMergeUnrelatedHistories(err) {
12881288
log.Debug("MergeUnrelatedHistories error: %v", err)
12891289
ctx.Flash.Error(ctx.Tr("repo.pulls.unrelated_histories"))
1290-
ctx.Redirect(issue.Link())
1290+
ctx.JSONRedirect(issue.Link())
12911291
} else if git.IsErrPushOutOfDate(err) {
12921292
log.Debug("MergePushOutOfDate error: %v", err)
12931293
ctx.Flash.Error(ctx.Tr("repo.pulls.merge_out_of_date"))
1294-
ctx.Redirect(issue.Link())
1294+
ctx.JSONRedirect(issue.Link())
12951295
} else if models.IsErrSHADoesNotMatch(err) {
12961296
log.Debug("MergeHeadOutOfDate error: %v", err)
12971297
ctx.Flash.Error(ctx.Tr("repo.pulls.head_out_of_date"))
1298-
ctx.Redirect(issue.Link())
1298+
ctx.JSONRedirect(issue.Link())
12991299
} else if git.IsErrPushRejected(err) {
13001300
log.Debug("MergePushRejected error: %v", err)
13011301
pushrejErr := err.(*git.ErrPushRejected)

0 commit comments

Comments
 (0)