Add merged commit id on pull view when it's merged (#8062)

This commit is contained in:
Lunny Xiao 2019-09-03 14:29:36 +08:00 committed by Lauris BH
parent 8ae96a37ce
commit 6ed22ffd16
2 changed files with 7 additions and 1 deletions
options/locale
templates/repo/issue/view_content

View file

@ -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

View file

@ -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">
{{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>