From e4df2e0620089b77ca01c94a9af15850db0350d0 Mon Sep 17 00:00:00 2001 From: Alessio Date: Sat, 15 Feb 2025 15:17:26 -0800 Subject: [PATCH] Show number of related items in a Notification in the Notifications feed --- .../tpl/tweet_page_includes/notification.tpl | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/internal/webserver/tpl/tweet_page_includes/notification.tpl b/internal/webserver/tpl/tweet_page_includes/notification.tpl index 780e9e2..42c0886 100644 --- a/internal/webserver/tpl/tweet_page_includes/notification.tpl +++ b/internal/webserver/tpl/tweet_page_includes/notification.tpl @@ -1,7 +1,7 @@ {{define "notification"}} {{$notification := (notification .NotificationID)}} -
+
{{if (not (eq $notification.ActionUserID 0))}}
@@ -26,15 +26,30 @@
{{if (eq $notification.Type 1)}} {{/* LIKE */}} - {{(user $notification.ActionUserID).DisplayName}} liked your tweet + {{ $num_liked_items := (add (len $notification.RetweetIDs) (len $notification.TweetIDs))}} + {{if (gt (len $notification.UserIDs) 1)}} + {{(user $notification.ActionUserID).DisplayName}} and {{(len (slice $notification.UserIDs 1))}} others liked your tweet + {{else if (gt $num_liked_items 1)}} + {{(user $notification.ActionUserID).DisplayName}} liked {{ $num_liked_items }} of your tweets + {{else}} + {{(user $notification.ActionUserID).DisplayName}} liked your tweet + {{end}} {{else if (eq $notification.Type 2)}} {{/* RETWEET */}} - {{(user $notification.ActionUserID).DisplayName}} retweeted you + {{if (gt (len $notification.UserIDs) 1)}} + {{(user $notification.ActionUserID).DisplayName}} and {{(len (slice $notification.UserIDs 1))}} others retweeted you + {{else}} + {{(user $notification.ActionUserID).DisplayName}} retweeted you + {{end}} {{else if (eq $notification.Type 3)}} {{/* QUOTE_TWEET */}} {{(user $notification.ActionUserID).DisplayName}} quote-tweeted you {{else if (eq $notification.Type 4)}} {{/* REPLY */}} {{(user $notification.ActionUserID).DisplayName}} replied to you {{else if (eq $notification.Type 5)}} {{/* FOLLOW */}} - {{(user $notification.ActionUserID).DisplayName}} followed you! + {{if (gt (len $notification.UserIDs) 1)}} + {{(user $notification.ActionUserID).DisplayName}} and {{(len (slice $notification.UserIDs 1))}} others followed you + {{else}} + {{(user $notification.ActionUserID).DisplayName}} followed you! + {{end}} {{else if (eq $notification.Type 6)}} {{/* MENTION */}} {{(user $notification.ActionUserID).DisplayName}} mentioned you {{else if (eq $notification.Type 7)}} {{/* USER_IS_LIVE */}}