From e9b39250b285f1b9cbf9739f33c06fc57401f314 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 3 May 2023 21:52:19 +0800 Subject: [PATCH] Improve pull request merge box when pull request merged and branch deleted. (#24397) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR hide the pull request merge box totally if it's merged and branch deleted. It's also add a bold for merge base commit id in merged message comment Before: 图片 After: 图片 --------- Co-authored-by: silverwind Co-authored-by: wxiaoguang --- options/locale/locale_en-US.ini | 4 ++-- .../repo/issue/view_content/comments.tmpl | 4 ++-- templates/repo/issue/view_content/pull.tmpl | 24 ++++++++++++------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 600f8d6086..b4d5ba00bc 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1414,8 +1414,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 %[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 464f41be1a..13e3b53051 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.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) (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" ($.BaseTarget|Escape)) $createdStr | Safe}} {{end}} diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index aa9b240736..ec957161b1 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 because this page already contains enough information */}} +{{else}}