summaryrefslogtreecommitdiffstats
path: root/templates/user
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-12-05 14:07:15 +0800
committerGitHub <noreply@github.com>2023-12-05 06:07:15 +0000
commit08445d5d863e23d2e540d44ace030da0bd474bbf (patch)
tree8e604e97546ea775585acb289fbda7edebef02b3 /templates/user
parentb71d4c3ec01ac8db71f5c417ea570f258b165cb6 (diff)
downloadgitea-08445d5d863e23d2e540d44ace030da0bd474bbf.tar.gz
gitea-08445d5d863e23d2e540d44ace030da0bd474bbf.zip
Refactor template empty checks (#28351) (#28354)
Backport #28351 by @KN4CK3R Fix #28347 As there is no info how to reproduce it, I can't test it. Fix may be `section_split.tmpl @ 126/130`. Other changes are "empty check" refactorings. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Diffstat (limited to 'templates/user')
-rw-r--r--templates/user/dashboard/feeds.tmpl2
-rw-r--r--templates/user/notification/notification_div.tmpl2
-rw-r--r--templates/user/notification/notification_subscriptions.tmpl2
-rw-r--r--templates/user/settings/keys_gpg.tmpl2
4 files changed, 4 insertions, 4 deletions
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl
index c986dcfb44..974b59b7c3 100644
--- a/templates/user/dashboard/feeds.tmpl
+++ b/templates/user/dashboard/feeds.tmpl
@@ -105,7 +105,7 @@
{{else if .GetOpType.InActions "comment_issue" "approve_pull_request" "reject_pull_request" "comment_pull"}}
<a href="{{.GetCommentLink ctx}}" class="text truncate issue title">{{(.GetIssueTitle ctx) | RenderEmoji $.Context | RenderCodeBlock}}</a>
{{$comment := index .GetIssueInfos 1}}
- {{if gt (len $comment) 0}}
+ {{if $comment}}
<div class="markup gt-font-14">{{RenderMarkdownToHtml ctx $comment}}</div>
{{end}}
{{else if .GetOpType.InActions "merge_pull_request"}}
diff --git a/templates/user/notification/notification_div.tmpl b/templates/user/notification/notification_div.tmpl
index e98eff9cff..d8f8d462d3 100644
--- a/templates/user/notification/notification_div.tmpl
+++ b/templates/user/notification/notification_div.tmpl
@@ -24,7 +24,7 @@
</div>
<div class="gt-p-0">
<div id="notification_table">
- {{if eq (len .Notifications) 0}}
+ {{if not .Notifications}}
<div class="gt-df gt-ac gt-fc gt-p-4">
{{svg "octicon-inbox" 56 "gt-mb-4"}}
{{if eq .Status 1}}
diff --git a/templates/user/notification/notification_subscriptions.tmpl b/templates/user/notification/notification_subscriptions.tmpl
index 7eb4c8ea44..ec40d3afea 100644
--- a/templates/user/notification/notification_subscriptions.tmpl
+++ b/templates/user/notification/notification_subscriptions.tmpl
@@ -63,7 +63,7 @@
</div>
</div>
<div class="divider"></div>
- {{if eq (len .Issues) 0}}
+ {{if not .Issues}}
{{ctx.Locale.Tr "notification.no_subscriptions"}}
{{else}}
{{template "shared/issuelist" dict "." . "listType" "dashboard"}}
diff --git a/templates/user/settings/keys_gpg.tmpl b/templates/user/settings/keys_gpg.tmpl
index bd560fa325..481d7482b4 100644
--- a/templates/user/settings/keys_gpg.tmpl
+++ b/templates/user/settings/keys_gpg.tmpl
@@ -55,7 +55,7 @@
{{if .Verified}}
<span class="flex-text-block" data-tooltip-content="{{ctx.Locale.Tr "settings.gpg_key_verified_long"}}">{{svg "octicon-verified"}} <strong>{{ctx.Locale.Tr "settings.gpg_key_verified"}}</strong></span>
{{end}}
- {{if gt (len .Emails) 0}}
+ {{if .Emails}}
<span class="flex-text-block" data-tooltip-content="{{ctx.Locale.Tr "settings.gpg_key_matched_identities_long"}}">{{svg "octicon-mail"}} {{ctx.Locale.Tr "settings.gpg_key_matched_identities"}} {{range .Emails}}<strong>{{.Email}} </strong>{{end}}</span>
{{end}}
<div class="flex-item-body">