From 6ed22ffd16b80348d52daa0e1915608d307bfe87 Mon Sep 17 00:00:00 2001 From: Lunny Xiao <xiaolunwen@gmail.com> Date: Tue, 3 Sep 2019 14:29:36 +0800 Subject: [PATCH] Add merged commit id on pull view when it's merged (#8062) --- options/locale/locale_en-US.ini | 1 + templates/repo/issue/view_content/pull.tmpl | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 4d2031c5de..b76d82ca86 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -971,6 +971,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 = The pull request has been merged as <a rel="nofollow" class="ui sha" href="%[1]s"><code>%[2]s</code></a>. pulls.has_merged = The pull request has been merged. pulls.title_wip_desc = `<a href="#">Start the title with <strong>%s</strong></a> to prevent the pull request from being merged accidentally.` pulls.cannot_merge_work_in_progress = This pull request is marked as a work in progress. Remove the <strong>%s</strong> prefix from the title when it's ready diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 7bb3c91275..f0e39d5e37 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -49,7 +49,12 @@ <div class="ui {{if not $.LatestCommitStatus}}top attached header{{else}}attached merge-section segment{{end}}"> {{if .Issue.PullRequest.HasMerged}} <div class="item text purple"> - {{$.i18n.Tr "repo.pulls.has_merged"}} + {{if .Issue.PullRequest.MergedCommitID}} + {{$link := printf "%s/commit/%s" $.Repository.HTMLURL .Issue.PullRequest.MergedCommitID}} + {{$.i18n.Tr "repo.pulls.merged_as" $link (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}} + {{else}} + {{$.i18n.Tr "repo.pulls.has_merged"}} + {{end}} </div> {{if .IsPullBranchDeletable}} <div class="ui divider"></div>