diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-02 20:45:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-02 12:45:14 +0000 |
commit | e650f64d812f5ebeb4a11d2ec20f2376c6d963bc (patch) | |
tree | ed16e2e8a68b50ef03e6e1c6e8d17a64861c8dc8 | |
parent | c0c2cb933bc59c5c9b2558c9bf53b495504f35f3 (diff) | |
download | gitea-e650f64d812f5ebeb4a11d2ec20f2376c6d963bc.tar.gz gitea-e650f64d812f5ebeb4a11d2ec20f2376c6d963bc.zip |
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>
-rw-r--r-- | options/locale/locale_en-US.ini | 4 | ||||
-rw-r--r-- | routers/web/repo/pull.go | 2 | ||||
-rw-r--r-- | templates/repo/diff/compare.tmpl | 8 | ||||
-rw-r--r-- | templates/repo/issue/new.tmpl | 8 | ||||
-rw-r--r-- | templates/repo/issue/new_form.tmpl | 8 |
5 files changed, 6 insertions, 24 deletions
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 6d4e109e1d..beda02603e 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1792,9 +1792,9 @@ pulls.unrelated_histories = Merge Failed: The merge head and base do not share a pulls.merge_out_of_date = Merge Failed: Whilst generating the merge, the base was updated. Hint: Try again. pulls.head_out_of_date = Merge Failed: Whilst generating the merge, the head was updated. Hint: Try again. pulls.has_merged = Failed: The pull request has been merged, you cannot merge again or change the target branch. -pulls.push_rejected = Merge Failed: The push was rejected. Review the Git Hooks for this repository. +pulls.push_rejected = Push Failed: The push was rejected. Review the Git Hooks for this repository. pulls.push_rejected_summary = Full Rejection Message -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 +pulls.push_rejected_no_message = Push Failed: The push was rejected but there was no remote message. Review the Git Hooks for this repository pulls.open_unmerged_pull_exists = `You cannot perform a reopen operation because there is a pending pull request (#%d) with identical properties.` pulls.status_checking = Some checks are pending pulls.status_checks_success = All checks were successful diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index c97edd8720..428fe23156 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -1501,7 +1501,7 @@ func CompareAndPullRequestPost(ctx *context.Context) { return } ctx.Flash.Error(flashError) - ctx.JSONRedirect(pullIssue.Link()) // FIXME: it's unfriendly, and will make the content lost + ctx.JSONRedirect(ctx.Link + "?" + ctx.Req.URL.RawQuery) // FIXME: it's unfriendly, and will make the content lost return } ctx.ServerError("NewPullRequest", err) diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index 819bd8a2f0..e460d4da3b 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -11,14 +11,6 @@ {{ctx.Locale.Tr "action.compare_commits_general"}} {{end}} </h2> - {{if .Flash.WarningMsg}} - {{/* - There's already an importing of alert.tmpl in new_form.tmpl, - but only the negative message will be displayed within forms for some reasons, see semantic.css:10659. - To avoid repeated negative messages, the importing here if for .Flash.WarningMsg only. - */}} - {{template "base/alert" .}} - {{end}} {{$BaseCompareName := $.BaseName -}} {{- $HeadCompareName := $.HeadRepo.OwnerName -}} {{- if and (eq $.BaseName $.HeadRepo.OwnerName) (ne $.Repository.Name $.HeadRepo.Name) -}} diff --git a/templates/repo/issue/new.tmpl b/templates/repo/issue/new.tmpl index 780e874bc6..ccd45fdebe 100644 --- a/templates/repo/issue/new.tmpl +++ b/templates/repo/issue/new.tmpl @@ -2,14 +2,6 @@ <div role="main" aria-label="{{.Title}}" class="page-content repository new issue"> {{template "repo/header" .}} <div class="ui container"> - {{if .Flash.WarningMsg}} - {{/* - There's already an importing of alert.tmpl in new_form.tmpl, - but only the negative message will be displayed within forms for some reasons, see semantic.css:10659. - To avoid repeated negative messages, the importing here if for .Flash.WarningMsg only. - */}} - {{template "base/alert" .}} - {{end}} {{template "repo/issue/new_form" .}} </div> </div> diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 8e4310f0bb..e67314bfd5 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -1,10 +1,8 @@ +{{if .Flash}} +{{template "base/alert" .}} +{{end}} <form class="issue-content ui comment form form-fetch-action" id="new-issue" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - {{if .Flash}} - <div class="sixteen wide column"> - {{template "base/alert" .}} - </div> - {{end}} <div class="issue-content-left"> <div class="ui comments"> <div class="comment"> |