diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-05-03 21:52:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-03 21:52:19 +0800 |
commit | e9b39250b285f1b9cbf9739f33c06fc57401f314 (patch) | |
tree | 8617e742a405493f3174a44b0bba42b0939de315 /templates | |
parent | a9ed87ce4a8a529ce451e11ebbff45a178677a62 (diff) | |
download | gitea-e9b39250b285f1b9cbf9739f33c06fc57401f314.tar.gz gitea-e9b39250b285f1b9cbf9739f33c06fc57401f314.zip |
Improve pull request merge box when pull request merged and branch deleted. (#24397)
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:
<img width="989" alt="图片"
src="https://user-images.githubusercontent.com/81045/235066590-28deb506-e824-4a42-a9a2-791cd136756e.png">
After:
<img width="1030" alt="图片"
src="https://user-images.githubusercontent.com/81045/235080749-11d5efe8-a06e-4528-a75f-f6c6d191db50.png">
---------
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/issue/view_content/pull.tmpl | 24 |
2 files changed, 17 insertions, 11 deletions
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 "<a class='ui sha' href='%[1]s'><b>%[2]s</b></a>" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID)) (printf "<b>%[1]s</b>" ($.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 "<a class='ui sha' href='%[1]s'><b>%[2]s</b></a>" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID)) (printf "<b>%[1]s</b>" ($.BaseTarget|Escape)) $createdStr | Safe}} {{end}} </span> </div> 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 @@ </div> </div> {{end}} +{{if and .Issue.PullRequest.HasMerged (not .IsPullBranchDeletable)}} +{{/* Then the merge box will not be displayed because this page already contains enough information */}} +{{else}} <div class="timeline-item comment merge box"> <a class="timeline-avatar text {{if .Issue.PullRequest.HasMerged}}purple {{- else if .Issue.IsClosed}}grey @@ -131,19 +134,21 @@ {{$showGeneralMergeForm := false}} <div class="ui attached merge-section segment {{if not $.LatestCommitStatus}}no-header{{end}}"> {{if .Issue.PullRequest.HasMerged}} - <div class="item item-section text gt-f1"> - <div class="item-section-left"> - <h3 class="gt-mb-3">{{$.locale.Tr "repo.pulls.merged_success"}}</h3> - <div class="merge-section-info"> - {{$.locale.Tr "repo.pulls.merged_info_text" (printf "<code>%s</code>" (.HeadTarget | Escape)) | Str2html}} + {{if .IsPullBranchDeletable}} + <div class="item item-section text gt-f1"> + <div class="item-section-left"> + <h3 class="gt-mb-3"> + {{$.locale.Tr "repo.pulls.merged_success"}} + </h3> + <div class="merge-section-info"> + {{$.locale.Tr "repo.pulls.merged_info_text" (printf "<code>%s</code>" (.HeadTarget | Escape)) | Str2html}} + </div> </div> - </div> - {{if .IsPullBranchDeletable}} <div class="item-section-right"> <button class="delete-button ui button" data-url="{{.DeleteBranchLink}}">{{$.locale.Tr "repo.branch.delete_html"}}</button> </div> - {{end}} - </div> + </div> + {{end}} {{else if .Issue.IsClosed}} <div class="item item-section text gt-f1"> <div class="item-section-left"> @@ -485,3 +490,4 @@ </div> </div> </div> +{{end}} |