From 545495dcb0a4cb9d820132dde4f1127f7fe91aa4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 1 Mar 2023 20:19:47 +0100 Subject: [PATCH] Pull Requests: add button to compare force pushed commits (#22857) To quickly see what changed without having to re-read the whole diff. --- options/locale/locale_en-US.ini | 1 + templates/repo/issue/view_content/comments.tmpl | 5 +++++ web_src/less/_repository.less | 11 +++++++++++ 3 files changed, 17 insertions(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 2109950ca8..1d1a0f588d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1470,6 +1470,7 @@ issues.error_removing_due_date = "Failed to remove the due date." issues.push_commit_1 = "added %d commit %s" issues.push_commits_n = "added %d commits %s" issues.force_push_codes = `force-pushed %[1]s from %[2]s to %[4]s %[6]s` +issues.force_push_compare = Compare issues.due_date_form = "yyyy-mm-dd" issues.due_date_form_add = "Add due date" issues.due_date_form_edit = "Edit" diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 94b46bd9f1..d2a4af9417 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -707,6 +707,11 @@ {{$.locale.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr | Safe}} {{end}} + {{if and .IsForcePush $.Issue.PullRequest.BaseRepo.Name}} + + {{$.locale.Tr "repo.issues.force_push_compare"}} + + {{end}} {{if not .IsForcePush}} {{template "repo/commits_list_small" dict "comment" . "root" $}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index a8106c5bf8..abbacfb532 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -952,6 +952,17 @@ margin-top: 4px; } + .comparebox { + line-height: 32px; + vertical-align: middle; + + .compare.label { + font-size: 1rem; + margin: 0; + border: 1px solid var(--color-light-border); + } + } + .comment-form-reply .footer { padding-bottom: 1em; }