Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve pull request merge box when pull request merged and branch deleted. #24397

Merged
merged 10 commits into from
May 3, 2023
4 changes: 2 additions & 2 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> into <b>%[3]s</b> %[4]s`
issues.manually_pull_merged_at = `merged commit <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> into <b>%[3]s</b> 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`
lunny marked this conversation as resolved.
Show resolved Hide resolved
issues.close_comment_issue = Comment and Close
issues.reopen_issue = Reopen
issues.reopen_comment_issue = Comment and Reopen
Expand Down
4 changes: 2 additions & 2 deletions templates/repo/issue/view_content/comments.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
24 changes: 15 additions & 9 deletions templates/repo/issue/view_content/pull.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@
</div>
</div>
{{end}}
{{if and .Issue.PullRequest.HasMerged (not .IsPullBranchDeletable)}}
{{/* Then the merge box will not be displayed */}}
lunny marked this conversation as resolved.
Show resolved Hide resolved
{{else}}
<div class="timeline-item comment merge box">
<a class="timeline-avatar text {{if .Issue.PullRequest.HasMerged}}purple
{{- else if .Issue.IsClosed}}grey
Expand All @@ -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">
Expand Down Expand Up @@ -485,3 +490,4 @@
</div>
</div>
</div>
{{end}}