From c4ca9a0c1430d38e185f898d14b1d1a7d6d0c6e1 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 28 Apr 2023 13:57:29 +0800 Subject: [PATCH 1/6] Fix wrong delete branch text --- options/locale/locale_en-US.ini | 3 ++- templates/repo/issue/view_content/pull.tmpl | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 3fff13c5a27ef..980f277023f40 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1626,7 +1626,8 @@ pulls.tab_files = Files Changed pulls.reopen_to_merge = Please reopen this pull request to perform a merge. pulls.cant_reopen_deleted_branch = This pull request cannot be reopened because the branch was deleted. pulls.merged = Merged -pulls.merged_success = Pull request successfully merged and closed +pulls.merged_as = Pull request has been merged as %s. +pulls.merged_success = Pull request successfully merged. pulls.closed = Pull request closed pulls.manually_merged = Manually merged pulls.merged_info_text = The branch %s can now be deleted. diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 5e405c9d2cf91..d5c352e59d219 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -133,10 +133,19 @@ {{if .Issue.PullRequest.HasMerged}}
-

{{$.locale.Tr "repo.pulls.merged_success"}}

- +

+ {{if .Issue.PullRequest.MergedCommitID}} + {{$link := printf "%s/commit/%s" $.Repository.Link (.Issue.PullRequest.MergedCommitID|PathEscape)}} + {{$.locale.Tr "repo.pulls.merged_as" (printf "%s" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID)) | Str2html}} + {{else}} + {{$.locale.Tr "repo.pulls.merged_success"}} + {{end}} +

+ {{if .IsPullBranchDeletable}} + + {{end}}
{{if .IsPullBranchDeletable}}
From ac8e5eae576e140ec0c170c9eb9c90a6ec40febb Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 28 Apr 2023 15:16:33 +0800 Subject: [PATCH 2/6] Adjust pull request branch delete section --- options/locale/locale_en-US.ini | 9 +++--- .../repo/issue/view_content/comments.tmpl | 4 +-- templates/repo/issue/view_content/pull.tmpl | 29 +++++++++---------- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 980f277023f40..3c17213ec777d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1411,8 +1411,8 @@ issues.context.edit = Edit issues.context.delete = Delete issues.no_content = There is no content yet. issues.close = Close Issue -issues.pull_merged_at = `merged commit %[2]s into %[3]s %[4]s` -issues.manually_pull_merged_at = `merged commit %[2]s into %[3]s manually %[4]s` +issues.pull_merged_at = `merged commit %[2]s into %[3]s %[4]s` +issues.manually_pull_merged_at = `merged commit %[2]s into %[3]s manually %[4]s` issues.close_comment_issue = Comment and Close issues.reopen_issue = Reopen issues.reopen_comment_issue = Comment and Reopen @@ -1626,8 +1626,7 @@ pulls.tab_files = Files Changed pulls.reopen_to_merge = Please reopen this pull request to perform a merge. pulls.cant_reopen_deleted_branch = This pull request cannot be reopened because the branch was deleted. pulls.merged = Merged -pulls.merged_as = Pull request has been merged as %s. -pulls.merged_success = Pull request successfully merged. +pulls.merged_success = Pull request successfully merged and closed pulls.closed = Pull request closed pulls.manually_merged = Manually merged pulls.merged_info_text = The branch %s can now be deleted. @@ -2381,7 +2380,7 @@ branch.already_exists = A branch named "%s" already exists. branch.delete_head = Delete branch.delete = Delete Branch "%s" branch.delete_html = Delete Branch -branch.delete_desc = Deleting a branch is permanent. It CANNOT be undone. Continue? +branch.delete_desc = Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue? branch.deletion_success = Branch "%s" has been deleted. branch.deletion_failed = Failed to delete branch "%s". branch.delete_branch_has_new_commits = Branch "%s" cannot be deleted because new commits have been added after merging. diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index b99e49a586342..6bf34a8b562fa 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -125,9 +125,9 @@ {{template "shared/user/authorlink" .Poster}} {{$link := printf "%s/commit/%s" $.Repository.Link ($.Issue.PullRequest.MergedCommitID|PathEscape)}} {{if eq $.Issue.PullRequest.Status 3}} - {{$.locale.Tr "repo.issues.manually_pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Safe}} + {{$.locale.Tr "repo.issues.manually_pull_merged_at" ($link|Escape) (printf "%s" (ShortSha $.Issue.PullRequest.MergedCommitID)) ($.BaseTarget|Escape) $createdStr | Safe}} {{else}} - {{$.locale.Tr "repo.issues.pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Safe}} + {{$.locale.Tr "repo.issues.pull_merged_at" ($link|Escape) (printf "%s" (ShortSha $.Issue.PullRequest.MergedCommitID)) ($.BaseTarget|Escape) $createdStr | Safe}} {{end}}
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index d5c352e59d219..ffdc0a813a335 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -108,6 +108,9 @@
{{end}} +{{if and .Issue.PullRequest.HasMerged (not .IsPullBranchDeletable)}} +{{/* Then the merge box will not be displayed */}} +{{else}}
{{if .Issue.PullRequest.HasMerged}} -
-
-

- {{if .Issue.PullRequest.MergedCommitID}} - {{$link := printf "%s/commit/%s" $.Repository.Link (.Issue.PullRequest.MergedCommitID|PathEscape)}} - {{$.locale.Tr "repo.pulls.merged_as" (printf "%s" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID)) | Str2html}} - {{else}} - {{$.locale.Tr "repo.pulls.merged_success"}} - {{end}} -

- {{if .IsPullBranchDeletable}} + {{if .IsPullBranchDeletable}} +
+
+

+ {{$.locale.Tr "repo.pulls.merged_success"}} +

- {{end}} -
- {{if .IsPullBranchDeletable}} +
- {{end}} -
+
+ {{end}} {{else if .Issue.IsClosed}}
@@ -494,3 +490,4 @@
+{{end}} From 1a4c483e20e8a784ef386f4242cba6ff06fff312 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 28 Apr 2023 15:56:42 +0800 Subject: [PATCH 3/6] simple translation content --- options/locale/locale_en-US.ini | 4 ++-- templates/repo/issue/view_content/comments.tmpl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 3c17213ec777d..1391edc98ecdb 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1411,8 +1411,8 @@ issues.context.edit = Edit issues.context.delete = Delete issues.no_content = There is no content yet. issues.close = Close Issue -issues.pull_merged_at = `merged commit %[2]s into %[3]s %[4]s` -issues.manually_pull_merged_at = `merged commit %[2]s into %[3]s manually %[4]s` +issues.comment_pull_merged_at = `merged commit %[1]s into %[2]s` +issues.comment_manually_pull_merged_at = `merged commit %[1]s into %[2]s manually %[3]s` issues.close_comment_issue = Comment and Close issues.reopen_issue = Reopen issues.reopen_comment_issue = Comment and Reopen diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 6bf34a8b562fa..cf21a0e5c48b6 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -125,9 +125,9 @@ {{template "shared/user/authorlink" .Poster}} {{$link := printf "%s/commit/%s" $.Repository.Link ($.Issue.PullRequest.MergedCommitID|PathEscape)}} {{if eq $.Issue.PullRequest.Status 3}} - {{$.locale.Tr "repo.issues.manually_pull_merged_at" ($link|Escape) (printf "%s" (ShortSha $.Issue.PullRequest.MergedCommitID)) ($.BaseTarget|Escape) $createdStr | Safe}} + {{$.locale.Tr "repo.issues.comment_manually_pull_merged_at" (printf "%[2]s" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID)) (printf "%[1]s" ($.BaseTarget|Escape)) $createdStr | Safe}} {{else}} - {{$.locale.Tr "repo.issues.pull_merged_at" ($link|Escape) (printf "%s" (ShortSha $.Issue.PullRequest.MergedCommitID)) ($.BaseTarget|Escape) $createdStr | Safe}} + {{$.locale.Tr "repo.issues.comment_pull_merged_at" (printf "%[2]s" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID)) (printf "%[1]s %[2]s" ($.BaseTarget|Escape) $createdStr) | Safe}} {{end}} From 5286788932c47759cb0322057998d472028ec983 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 28 Apr 2023 16:00:11 +0800 Subject: [PATCH 4/6] fine tune --- options/locale/locale_en-US.ini | 4 ++-- templates/repo/issue/view_content/comments.tmpl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 1391edc98ecdb..27015aff6b5af 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1411,8 +1411,8 @@ issues.context.edit = Edit issues.context.delete = Delete issues.no_content = There is no content yet. issues.close = Close Issue -issues.comment_pull_merged_at = `merged commit %[1]s into %[2]s` -issues.comment_manually_pull_merged_at = `merged commit %[1]s into %[2]s manually %[3]s` +issues.comment_pull_merged_at = `merged commit %[1]s into %[2]s %[3]s` +issues.comment_manually_pull_merged_at = `manually merged commit %[1]s into %[2]s %[3]s` issues.close_comment_issue = Comment and Close issues.reopen_issue = Reopen issues.reopen_comment_issue = Comment and Reopen diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index cf21a0e5c48b6..d3f484e7d5b2a 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -127,7 +127,7 @@ {{if eq $.Issue.PullRequest.Status 3}} {{$.locale.Tr "repo.issues.comment_manually_pull_merged_at" (printf "%[2]s" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID)) (printf "%[1]s" ($.BaseTarget|Escape)) $createdStr | Safe}} {{else}} - {{$.locale.Tr "repo.issues.comment_pull_merged_at" (printf "%[2]s" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID)) (printf "%[1]s %[2]s" ($.BaseTarget|Escape) $createdStr) | Safe}} + {{$.locale.Tr "repo.issues.comment_pull_merged_at" (printf "%[2]s" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID)) (printf "%[1]s" ($.BaseTarget|Escape)) $createdStr | Safe}} {{end}} From 2c699388961d437c34f7a7c1c1caf3c097f119b3 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 29 Apr 2023 18:01:57 +0800 Subject: [PATCH 5/6] Update options/locale/locale_en-US.ini Co-authored-by: silverwind --- options/locale/locale_en-US.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 27015aff6b5af..57ff759f5b627 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1411,8 +1411,8 @@ issues.context.edit = Edit issues.context.delete = Delete issues.no_content = There is no content yet. issues.close = Close Issue -issues.comment_pull_merged_at = `merged commit %[1]s into %[2]s %[3]s` -issues.comment_manually_pull_merged_at = `manually merged commit %[1]s into %[2]s %[3]s` +issues.comment_pull_merged_at = merged commit %[1]s into %[2]s %[3]s +issues.comment_manually_pull_merged_at = manually merged commit %[1]s into %[2]s %[3]s issues.close_comment_issue = Comment and Close issues.reopen_issue = Reopen issues.reopen_comment_issue = Comment and Reopen From 4a3ef4f81f7905a66e32ad6604bb96a4eb41034e Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 3 May 2023 20:29:07 +0800 Subject: [PATCH 6/6] Update templates/repo/issue/view_content/pull.tmpl Co-authored-by: wxiaoguang --- templates/repo/issue/view_content/pull.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index c66e2fe434230..ec957161b1a36 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -109,7 +109,7 @@ {{end}} {{if and .Issue.PullRequest.HasMerged (not .IsPullBranchDeletable)}} -{{/* Then the merge box will not be displayed */}} +{{/* Then the merge box will not be displayed because this page already contains enough information */}} {{else}}