Skip to content

Commit 971eab1

Browse files
GiteaBotwxiaoguang
andauthored
Fix incorrect redirection when creating a PR fails (#29537) (#29543)
Backport #29537 by wxiaoguang This is only a quick fix to make it easier to backport. Co-authored-by: wxiaoguang <[email protected]>
1 parent 86cd94c commit 971eab1

File tree

5 files changed

+6
-24
lines changed

5 files changed

+6
-24
lines changed

options/locale/locale_en-US.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,9 +1775,9 @@ pulls.unrelated_histories = Merge Failed: The merge head and base do not share a
17751775
pulls.merge_out_of_date = Merge Failed: Whilst generating the merge, the base was updated. Hint: Try again.
17761776
pulls.head_out_of_date = Merge Failed: Whilst generating the merge, the head was updated. Hint: Try again.
17771777
pulls.has_merged = Failed: The pull request has been merged, you cannot merge again or change the target branch.
1778-
pulls.push_rejected = Merge Failed: The push was rejected. Review the Git Hooks for this repository.
1778+
pulls.push_rejected = Push Failed: The push was rejected. Review the Git Hooks for this repository.
17791779
pulls.push_rejected_summary = Full Rejection Message
1780-
pulls.push_rejected_no_message = Merge Failed: The push was rejected but there was no remote message.<br>Review the Git Hooks for this repository
1780+
pulls.push_rejected_no_message = Push Failed: The push was rejected but there was no remote message. Review the Git Hooks for this repository
17811781
pulls.open_unmerged_pull_exists = `You cannot perform a reopen operation because there is a pending pull request (#%d) with identical properties.`
17821782
pulls.status_checking = Some checks are pending
17831783
pulls.status_checks_success = All checks were successful

routers/web/repo/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,7 @@ func CompareAndPullRequestPost(ctx *context.Context) {
14691469
return
14701470
}
14711471
ctx.Flash.Error(flashError)
1472-
ctx.JSONRedirect(pullIssue.Link()) // FIXME: it's unfriendly, and will make the content lost
1472+
ctx.JSONRedirect(ctx.Link + "?" + ctx.Req.URL.RawQuery) // FIXME: it's unfriendly, and will make the content lost
14731473
return
14741474
}
14751475
ctx.ServerError("NewPullRequest", err)

templates/repo/diff/compare.tmpl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111
{{ctx.Locale.Tr "action.compare_commits_general"}}
1212
{{end}}
1313
</h2>
14-
{{if .Flash.WarningMsg}}
15-
{{/*
16-
There's already an importing of alert.tmpl in new_form.tmpl,
17-
but only the negative message will be displayed within forms for some reasons, see semantic.css:10659.
18-
To avoid repeated negative messages, the importing here if for .Flash.WarningMsg only.
19-
*/}}
20-
{{template "base/alert" .}}
21-
{{end}}
2214
{{$BaseCompareName := $.BaseName -}}
2315
{{- $HeadCompareName := $.HeadRepo.OwnerName -}}
2416
{{- if and (eq $.BaseName $.HeadRepo.OwnerName) (ne $.Repository.Name $.HeadRepo.Name) -}}

templates/repo/issue/new.tmpl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content repository new issue">
33
{{template "repo/header" .}}
44
<div class="ui container">
5-
{{if .Flash.WarningMsg}}
6-
{{/*
7-
There's already an importing of alert.tmpl in new_form.tmpl,
8-
but only the negative message will be displayed within forms for some reasons, see semantic.css:10659.
9-
To avoid repeated negative messages, the importing here if for .Flash.WarningMsg only.
10-
*/}}
11-
{{template "base/alert" .}}
12-
{{end}}
135
{{template "repo/issue/new_form" .}}
146
</div>
157
</div>

templates/repo/issue/new_form.tmpl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1+
{{if .Flash}}
2+
{{template "base/alert" .}}
3+
{{end}}
14
<form class="issue-content ui comment form form-fetch-action" id="new-issue" action="{{.Link}}" method="post">
25
{{.CsrfTokenHtml}}
3-
{{if .Flash}}
4-
<div class="sixteen wide column">
5-
{{template "base/alert" .}}
6-
</div>
7-
{{end}}
86
<div class="issue-content-left">
97
<div class="ui comments">
108
<div class="comment">

0 commit comments

Comments
 (0)