From bd30dfa15457327ba37454635834a05070348773 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 5 Feb 2024 20:04:49 +0800 Subject: [PATCH 1/5] Fix bug to go to 404 when creating pull request --- options/locale/locale_en-US.ini | 4 ++-- routers/web/repo/pull.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 9af4d70171c50..184532be07633 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1788,9 +1788,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.
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 b265cf47548bc..c696cfecea655 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -1455,8 +1455,7 @@ func CompareAndPullRequestPost(ctx *context.Context) { ctx.ServerError("CompareAndPullRequest.HTMLString", err) return } - ctx.Flash.Error(flashError) - ctx.JSONRedirect(pullIssue.Link()) // FIXME: it's unfriendly, and will make the content lost + ctx.JSONError(flashError) return } ctx.ServerError("NewPullRequest", err) From d78146c8ce527cfc52f5202f72c08766979cbcb9 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 5 Feb 2024 20:51:18 +0800 Subject: [PATCH 2/5] Remove br for json error --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 184532be07633..756203221e177 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1790,7 +1790,7 @@ pulls.head_out_of_date = Merge Failed: Whilst generating the merge, the head was pulls.has_merged = Failed: The pull request has been merged, you cannot merge again or change the target branch. 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 = Push Failed: The push was rejected but there was no remote message.
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 From 31b4dcf55ad67a9900ef0b23a589f84db64e6aa2 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 1 Mar 2024 00:19:05 +0800 Subject: [PATCH 3/5] Redirect to compare link again with warning --- routers/web/repo/pull.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index b0a3a46bb2c79..577a20afc52d5 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -1500,7 +1500,8 @@ func CompareAndPullRequestPost(ctx *context.Context) { ctx.ServerError("CompareAndPullRequest.HTMLString", err) return } - ctx.JSONError(flashError) + ctx.Flash.Warning(flashError) + ctx.JSONRedirect(ctx.Link) return } ctx.ServerError("NewPullRequest", err) From 9d120babebf92b65cadbb316b8975b28e1a80fda Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 1 Mar 2024 09:53:07 +0800 Subject: [PATCH 4/5] Add translation back --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index beda02603e3f9..8b2115687776e 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1794,7 +1794,7 @@ pulls.head_out_of_date = Merge Failed: Whilst generating the merge, the head was pulls.has_merged = Failed: The pull request has been merged, you cannot merge again or change the target branch. 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 = Push Failed: The push was rejected but there was no remote message. 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 From 06c838f77f77c6618ff53ef68282fc12233f68c2 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 1 Mar 2024 10:15:32 +0800 Subject: [PATCH 5/5] Revert "Add translation back" This reverts commit 9d120babebf92b65cadbb316b8975b28e1a80fda. --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 8b2115687776e..beda02603e3f9 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1794,7 +1794,7 @@ pulls.head_out_of_date = Merge Failed: Whilst generating the merge, the head was pulls.has_merged = Failed: The pull request has been merged, you cannot merge again or change the target branch. 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 = Push Failed: The push was rejected but there was no remote message.
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