]> source.dussan.org Git - gitea.git/commitdiff
Fix incorrect redirection when creating a PR fails (#29537) (#29543)
authorGiteabot <teabot@gitea.io>
Sat, 2 Mar 2024 20:01:19 +0000 (04:01 +0800)
committerGitHub <noreply@github.com>
Sat, 2 Mar 2024 20:01:19 +0000 (20:01 +0000)
Backport #29537 by wxiaoguang

This is only a quick fix to make it easier to backport.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
options/locale/locale_en-US.ini
routers/web/repo/pull.go
templates/repo/diff/compare.tmpl
templates/repo/issue/new.tmpl
templates/repo/issue/new_form.tmpl

index 714a2d1c05155a5eeb54c25cd9489bd81ae25e14..c5b576751d2afa473132369b7c8c30e856ab3161 100644 (file)
@@ -1775,9 +1775,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
index 70bbfeaca92bf6b53e53c45198c6287c9caef3eb..ec28e60fc9b4d65a76685bd3a96a5afc1c65eefc 100644 (file)
@@ -1469,7 +1469,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)
index 3e5df17f2248b8683e2b15297335c6581b6c46b6..4e13eddde3bc71bf86c72283b6ed7ace875d0644 100644 (file)
                        {{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) -}}
index 780e874bc6eb5865c74928ee6257910184f6b008..ccd45fdebedd05efc4b974a809503a5e4727d04a 100644 (file)
@@ -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>
index 04ae8456bb3c07e9fefbc5f5f7ff8771baa21353..41eb95a4bb94bab7a99c399a0372501f79b01b4b 100644 (file)
@@ -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">