Skip to content

Commit e650f64

Browse files
authored
Fix incorrect redirection when creating a PR fails (#29537)
This is only a quick fix to make it easier to backport. After this PR gets merged, I will propose a new PR to fix the FIXME. <details> ![image](https://github.com/go-gitea/gitea/assets/2114189/98d1d5c4-2e79-4a75-80e9-76fd898986e0) </details>
1 parent c0c2cb9 commit e650f64

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
@@ -1792,9 +1792,9 @@ pulls.unrelated_histories = Merge Failed: The merge head and base do not share a
17921792
pulls.merge_out_of_date = Merge Failed: Whilst generating the merge, the base was updated. Hint: Try again.
17931793
pulls.head_out_of_date = Merge Failed: Whilst generating the merge, the head was updated. Hint: Try again.
17941794
pulls.has_merged = Failed: The pull request has been merged, you cannot merge again or change the target branch.
1795-
pulls.push_rejected = Merge Failed: The push was rejected. Review the Git Hooks for this repository.
1795+
pulls.push_rejected = Push Failed: The push was rejected. Review the Git Hooks for this repository.
17961796
pulls.push_rejected_summary = Full Rejection Message
1797-
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
1797+
pulls.push_rejected_no_message = Push Failed: The push was rejected but there was no remote message. Review the Git Hooks for this repository
17981798
pulls.open_unmerged_pull_exists = `You cannot perform a reopen operation because there is a pending pull request (#%d) with identical properties.`
17991799
pulls.status_checking = Some checks are pending
18001800
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
@@ -1501,7 +1501,7 @@ func CompareAndPullRequestPost(ctx *context.Context) {
15011501
return
15021502
}
15031503
ctx.Flash.Error(flashError)
1504-
ctx.JSONRedirect(pullIssue.Link()) // FIXME: it's unfriendly, and will make the content lost
1504+
ctx.JSONRedirect(ctx.Link + "?" + ctx.Req.URL.RawQuery) // FIXME: it's unfriendly, and will make the content lost
15051505
return
15061506
}
15071507
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)