Skip to content

Commit 682a076

Browse files
GiteaBotsilverwind
andauthored
Hide diff stats on empty PRs (#30629) (#30645)
Backport #30629 by @silverwind When a PR is empty, e.g. has neither additions nor deletions, we don't need to show this: <img width="125" alt="Screenshot 2024-04-21 at 23 25 38" src="https://github.com/go-gitea/gitea/assets/115237/0b987eb5-66f5-4b9b-b5aa-7e9e267e9b52"> Co-authored-by: silverwind <[email protected]>
1 parent 706fc59 commit 682a076

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

templates/repo/pulls/tab_menu.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
{{ctx.Locale.Tr "repo.pulls.tab_files"}}
1616
<span class="ui small label">{{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}}</span>
1717
</a>
18+
{{if or .Diff.TotalAddition .Diff.TotalDeletion}}
1819
<span class="item tw-ml-auto tw-pr-0 tw-font-bold tw-flex tw-items-center tw-gap-2">
1920
<span><span class="text green">{{if .Diff.TotalAddition}}+{{.Diff.TotalAddition}}{{end}}</span> <span class="text red">{{if .Diff.TotalDeletion}}-{{.Diff.TotalDeletion}}{{end}}</span></span>
2021
<span class="diff-stats-bar">
2122
<div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .Diff.TotalAddition "/" "(" .Diff.TotalAddition "+" .Diff.TotalDeletion "+" 0.0 ")"}}%"></div>
2223
</span>
2324
</span>
25+
{{end}}
2426
</div>
2527
<div class="ui tabs divider"></div>
2628
</div>

0 commit comments

Comments
 (0)