-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only show diff file tree when more than one file changed #27775
Conversation
@@ -1,7 +1,8 @@ | |||
{{$showFileTree := (and (not .DiffNotAvailable) (gt .Diff.NumFiles 1))}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The double negation is an interesting choice.
Had to think way too hard about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, negated vars are generally bad, but you can read it as "if diff is available and number of files is greater than one".
* giteaoffical/main: Fix issue not showing on default board and add test (go-gitea#27720) Show placeholder email in privacy popup (go-gitea#27770) Add word-break to organization name and description (go-gitea#26624) Add border to file tree 'sub-items' and add padding to 'item-file' (go-gitea#27593) Fix the missing repo count in new team page and edit team page (go-gitea#27743) Only show diff file tree when more than one file changed (go-gitea#27775) Add gap between diff boxes (go-gitea#27776)
) 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: <img width="1234" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/3618438b-e655-42a3-989f-f299267b2b8b"> Co-authored-by: Giteabot <teabot@gitea.io>
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: