From 9ba07c1b70c712b5ba985079f90f94895062c656 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 6 Apr 2023 20:19:56 +0200 Subject: [PATCH 01/10] Tweak pull request branch delete ui --- templates/repo/issue/view_content/pull.tmpl | 31 +++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 8b758b2ac09a..204292229be4 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -131,24 +131,25 @@ {{$showGeneralMergeForm := false}}
{{if .Issue.PullRequest.HasMerged}} -
- {{if .Issue.PullRequest.MergedCommitID}} - {{$link := printf "%s/commit/%s" $.Repository.Link (.Issue.PullRequest.MergedCommitID|PathEscape)}} - {{if eq $.Issue.PullRequest.Status 3}} - {{$.locale.Tr "repo.pulls.manually_merged_as" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}} +
+
+ {{if .Issue.PullRequest.MergedCommitID}} + {{$link := printf "%s/commit/%s" $.Repository.Link (.Issue.PullRequest.MergedCommitID|PathEscape)}} + {{if eq $.Issue.PullRequest.Status 3}} + {{$.locale.Tr "repo.pulls.manually_merged_as" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}} + {{else}} + {{$.locale.Tr "repo.pulls.merged_as" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}} + {{end}} {{else}} - {{$.locale.Tr "repo.pulls.merged_as" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}} + {{$.locale.Tr "repo.pulls.has_merged"}} {{end}} - {{else}} - {{$.locale.Tr "repo.pulls.has_merged"}} +
+ {{if .IsPullBranchDeletable}} +
+
{{end}}
- {{if .IsPullBranchDeletable}} -
-
- {{$.locale.Tr "repo.branch.delete" .HeadTarget}} -
- {{end}} {{else if .Issue.IsClosed}}
{{if .IsPullRequestBroken}} @@ -471,7 +472,7 @@
{{end}} - {{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo}} + {{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo (not .Issue.PullRequest.HasMerged)}} {{template "repo/issue/view_content/pull_merge_instruction" (dict "locale" .locale "Issue" .Issue)}} {{end}}
From c9a7cb1c98d569b1f511e3a2f60d8d543cebe606 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 6 Apr 2023 21:53:34 +0200 Subject: [PATCH 02/10] fix closing tag --- templates/repo/issue/view_content/pull.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 204292229be4..c509008e26d0 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -146,7 +146,7 @@
{{if .IsPullBranchDeletable}}
-
{{end}} From f22a03ac05b4ed46eb44e3c2471b7c14be61e2eb Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 6 Apr 2023 22:04:04 +0200 Subject: [PATCH 03/10] handle closed state as well, hide cli when closed --- templates/repo/issue/view_content/pull.tmpl | 29 +++++++++++---------- web_src/css/repository.css | 5 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index c509008e26d0..d58867428c49 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -109,8 +109,8 @@ {{end}}
- {{else if .Issue.IsClosed}} -
- {{if .IsPullRequestBroken}} - {{$.locale.Tr "repo.pulls.cant_reopen_deleted_branch"}} - {{else}} - {{$.locale.Tr "repo.pulls.reopen_to_merge"}} +
+
+ {{if .IsPullRequestBroken}} + {{$.locale.Tr "repo.pulls.cant_reopen_deleted_branch"}} + {{else}} + {{$.locale.Tr "repo.pulls.reopen_to_merge"}} + {{end}} +
+ {{if and .IsPullBranchDeletable (not .IsPullRequestBroken)}} +
+ +
{{end}}
- {{if and .IsPullBranchDeletable ( not .IsPullRequestBroken )}} -
-
- {{$.locale.Tr "repo.branch.delete" .HeadTarget}} -
- {{end}} {{else if .IsPullFilesConflicted}}
{{svg "octicon-x"}} @@ -472,7 +473,7 @@
{{end}} - {{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo (not .Issue.PullRequest.HasMerged)}} + {{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo (not .Issue.PullRequest.HasMerged) (not .Issue.IsClosed)}} {{template "repo/issue/view_content/pull_merge_instruction" (dict "locale" .locale "Issue" .Issue)}} {{end}}
diff --git a/web_src/css/repository.css b/web_src/css/repository.css index 77b41e4d1607..86e1d927d54e 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -694,9 +694,8 @@ margin-right: 5px; } -.repository.view.issue .pull .merge.box .avatar { - margin-left: 10px; - margin-top: 10px; +.repository.view.issue .pull .merge.box .timeline-avatar { + margin-top: 2px; } .repository.view.issue .pull .merge.box .branch-update.grid .row { From 5c53324a3258f5939f063ba624e463819eef9494 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 6 Apr 2023 22:07:11 +0200 Subject: [PATCH 04/10] more alignment --- web_src/css/repository.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_src/css/repository.css b/web_src/css/repository.css index 86e1d927d54e..3f937b7f04cd 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -695,7 +695,8 @@ } .repository.view.issue .pull .merge.box .timeline-avatar { - margin-top: 2px; + margin-top: 3px; + margin-left: 4px; } .repository.view.issue .pull .merge.box .branch-update.grid .row { From 294c0e7fcbcf5b0825611cee2635bc10e74dc384 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 22 Apr 2023 22:24:54 +0200 Subject: [PATCH 05/10] revert closed to grey --- templates/repo/issue/view_content/pull.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index d58867428c49..4edf11d69037 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -110,7 +110,7 @@ {{end}}
%[2]s. +pulls.merged_as = Pull request successfully merged and closed pulls.manually_merged = Manually merged -pulls.manually_merged_as = The pull request has been manually merged as %[2]s. +pulls.merged_info_text = The branch %s can now be deleted. pulls.is_closed = The pull request has been closed. pulls.has_merged = The pull request has been merged. pulls.title_wip_desc = `Start the title with %s to prevent the pull request from being merged accidentally.` diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 4edf11d69037..470810dfb3a6 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -135,11 +135,10 @@
{{if .Issue.PullRequest.MergedCommitID}} {{$link := printf "%s/commit/%s" $.Repository.Link (.Issue.PullRequest.MergedCommitID|PathEscape)}} - {{if eq $.Issue.PullRequest.Status 3}} - {{$.locale.Tr "repo.pulls.manually_merged_as" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}} - {{else}} - {{$.locale.Tr "repo.pulls.merged_as" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}} - {{end}} +

{{$.locale.Tr "repo.pulls.merged_as"}}

+ {{else}} {{$.locale.Tr "repo.pulls.has_merged"}} {{end}} diff --git a/web_src/css/repository.css b/web_src/css/repository.css index 3f937b7f04cd..42dd3e9e3408 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -1036,6 +1036,13 @@ margin-top: -8px; } +.merge-section-info code { + border: 1px solid var(--color-light-border); + border-radius: 4px; + padding: 2px 4px; + background: var(--color-light); +} + .repository.view.issue .comment-list .comment .markup { font-size: 14px; } From e9bb2e87b4cf79ff85a8f58235a0ab2e7a337396 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 22 Apr 2023 23:10:10 +0200 Subject: [PATCH 07/10] update delete box as well --- options/locale/locale_en-US.ini | 4 ++-- templates/repo/issue/view_content/pull.tmpl | 26 ++++++++++----------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 90dcab60811e..8eb88cd22647 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1621,11 +1621,11 @@ 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 = Pull request successfully merged and closed +pulls.merged_success = Pull request successfully merged and closed +pulls.closed = Pull request closed pulls.manually_merged = Manually merged pulls.merged_info_text = The branch %s can now be deleted. pulls.is_closed = The pull request has been closed. -pulls.has_merged = The pull request has been merged. pulls.title_wip_desc = `Start the title with %s 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. pulls.still_in_progress = Still in progress? diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 470810dfb3a6..cae39b846fba 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -133,15 +133,10 @@ {{if .Issue.PullRequest.HasMerged}}
- {{if .Issue.PullRequest.MergedCommitID}} - {{$link := printf "%s/commit/%s" $.Repository.Link (.Issue.PullRequest.MergedCommitID|PathEscape)}} -

{{$.locale.Tr "repo.pulls.merged_as"}}

- - {{else}} - {{$.locale.Tr "repo.pulls.has_merged"}} - {{end}} +

{{$.locale.Tr "repo.pulls.merged_success"}}

+
{{if .IsPullBranchDeletable}}
@@ -152,11 +147,14 @@ {{else if .Issue.IsClosed}}
- {{if .IsPullRequestBroken}} - {{$.locale.Tr "repo.pulls.cant_reopen_deleted_branch"}} - {{else}} - {{$.locale.Tr "repo.pulls.reopen_to_merge"}} - {{end}} +

{{$.locale.Tr "repo.pulls.closed"}}

+
{{if and .IsPullBranchDeletable (not .IsPullRequestBroken)}}
From 5cd6d06e0db1ebb1801e21c778afd7efcba43cc1 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 23 Apr 2023 18:48:13 +0200 Subject: [PATCH 08/10] wip --- options/locale/locale_en-US.ini | 1 + templates/repo/issue/view_content/pull.tmpl | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 8eb88cd22647..e10de17bcee6 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1622,6 +1622,7 @@ 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_success = Pull request successfully merged and closed +pulls.merged_manually_success = Pull request successfully manually merged as %s and closed pulls.closed = Pull request closed pulls.manually_merged = Manually merged pulls.merged_info_text = The branch %s can now be deleted. diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index cae39b846fba..a4b60bd01179 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -133,9 +133,16 @@ {{if .Issue.PullRequest.HasMerged}}
-

{{$.locale.Tr "repo.pulls.merged_success"}}

+

+ {{if and (eq $.Issue.PullRequest.Status 3) (.Issue.PullRequest.MergedCommitID)}} + {{$link := printf "%s/commit/%s" $.Repository.Link (.Issue.PullRequest.MergedCommitID | PathEscape)}} + {{$.locale.Tr "repo.pulls.merged_manually_success"}} + {{else}} + {{$.locale.Tr "repo.pulls.merged_success" (printf "%s" ($link | Escape) (ShortSha .Issue.PullRequest.MergedCommitID | Escape) | Str2html}} + {{end}} +

{{if .IsPullBranchDeletable}} From 69936ef07495bf04b0097249031cba397bff733a Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 23 Apr 2023 19:12:41 +0200 Subject: [PATCH 09/10] Revert "wip" This reverts commit 5cd6d06e0db1ebb1801e21c778afd7efcba43cc1. --- options/locale/locale_en-US.ini | 1 - templates/repo/issue/view_content/pull.tmpl | 11 ++--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index e10de17bcee6..8eb88cd22647 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1622,7 +1622,6 @@ 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_success = Pull request successfully merged and closed -pulls.merged_manually_success = Pull request successfully manually merged as %s and closed pulls.closed = Pull request closed pulls.manually_merged = Manually merged pulls.merged_info_text = The branch %s can now be deleted. diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index a4b60bd01179..cae39b846fba 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -133,16 +133,9 @@ {{if .Issue.PullRequest.HasMerged}}
-

- {{if and (eq $.Issue.PullRequest.Status 3) (.Issue.PullRequest.MergedCommitID)}} - {{$link := printf "%s/commit/%s" $.Repository.Link (.Issue.PullRequest.MergedCommitID | PathEscape)}} - {{$.locale.Tr "repo.pulls.merged_manually_success"}} - {{else}} - {{$.locale.Tr "repo.pulls.merged_success" (printf "%s" ($link | Escape) (ShortSha .Issue.PullRequest.MergedCommitID | Escape) | Str2html}} - {{end}} -

+

{{$.locale.Tr "repo.pulls.merged_success"}}

{{if .IsPullBranchDeletable}} From e4d2e8345d2c188ce459bd4f8520d19ceb81a0ac Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 23 Apr 2023 19:17:24 +0200 Subject: [PATCH 10/10] escape HeadTarget --- templates/repo/issue/view_content/pull.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index cae39b846fba..899867ce7224 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -135,7 +135,7 @@

{{$.locale.Tr "repo.pulls.merged_success"}}

{{if .IsPullBranchDeletable}}