]> source.dussan.org Git - gitea.git/commitdiff
Pull Requests: add button to compare force pushed commits (#22857)
authorBrecht Van Lommel <brecht@blender.org>
Wed, 1 Mar 2023 19:19:47 +0000 (20:19 +0100)
committerGitHub <noreply@github.com>
Wed, 1 Mar 2023 19:19:47 +0000 (14:19 -0500)
To quickly see what changed without having to re-read the whole diff.

options/locale/locale_en-US.ini
templates/repo/issue/view_content/comments.tmpl
web_src/less/_repository.less

index 2109950ca85ca39ee9750c90d93a55749d42099d..1d1a0f588d256ee1a1b5e432545cec70c3a08e2c 100644 (file)
@@ -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 <a class="ui sha" href="%[3]s"><code>%[2]s</code></a> to <a class="ui sha" href="%[5]s"><code>%[4]s</code></a> %[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"
index 94b46bd9f13a9db623a74eba739efffe377e4245..d2a4af9417d84ae457085e15576ae6b21965f0fd 100644 (file)
                                                {{$.locale.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr | Safe}}
                                        {{end}}
                                </span>
+                               {{if and .IsForcePush $.Issue.PullRequest.BaseRepo.Name}}
+                               <span class="ui float right comparebox">
+                                       <a href="{{$.Issue.PullRequest.BaseRepo.Link}}/compare/{{PathEscape .OldCommit}}..{{PathEscape .NewCommit}}" rel="nofollow" class="ui compare label">{{$.locale.Tr "repo.issues.force_push_compare"}}</a>
+                               </span>
+                               {{end}}
                        </div>
                        {{if not .IsForcePush}}
                                {{template "repo/commits_list_small" dict "comment" . "root" $}}
index a8106c5bf8c161ee2b6da8cc8648883066846e86..abbacfb53246e4110803ff2c7e2592d34ff2016c 100644 (file)
           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;
         }