From 572f0963edc71239634ee782a3c69213479f34ba Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 25 Oct 2023 05:09:18 +0200 Subject: [PATCH] Only show diff file tree when more than one file changed (#27775) When 0 or 1 files changed in a diff, we don't need to show a file tree. This behaviour matches GitHub. Single-file diff after this change, note absence of button: image Co-authored-by: Giteabot --- templates/repo/diff/box.tmpl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 289ed90d3fd3..c037c3b36523 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -1,7 +1,8 @@ +{{$showFileTree := (and (not .DiffNotAvailable) (gt .Diff.NumFiles 1))}}
- {{if not .DiffNotAvailable}} + {{if $showFileTree}}