From 3670ae46ec5b7e8948a2742df1c3e06de0a01352 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 12 Jul 2022 10:32:56 -0700 Subject: [PATCH 1/2] Reverse order of notification related users --- bookwyrm/templates/notifications/items/layout.html | 11 +++++------ bookwyrm/templatetags/notification_page_tags.py | 6 ++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bookwyrm/templates/notifications/items/layout.html b/bookwyrm/templates/notifications/items/layout.html index 3830e7e40..8acbb9fec 100644 --- a/bookwyrm/templates/notifications/items/layout.html +++ b/bookwyrm/templates/notifications/items/layout.html @@ -2,7 +2,7 @@ {% load humanize %} {% related_status notification as related_status %} -{% with related_users=notification.related_users.all.distinct %} +{% get_related_users notification as related_users %} {% with related_user_count=notification.related_users.count %}
@@ -16,7 +16,7 @@ {% if related_user_count > 1 %} {% endwith %} -{% endwith %} diff --git a/bookwyrm/templatetags/notification_page_tags.py b/bookwyrm/templatetags/notification_page_tags.py index 28fa2afb5..7a365e689 100644 --- a/bookwyrm/templatetags/notification_page_tags.py +++ b/bookwyrm/templatetags/notification_page_tags.py @@ -12,3 +12,9 @@ def related_status(notification): if not notification.related_status: return None return load_subclass(notification.related_status) + + +@register.simple_tag(takes_context=False) +def get_related_users(notification): + """Who actually was it who liked your post""" + return list(reversed(list(notification.related_users.distinct())))[:10] From 235e877b3dde3cae111e79da0de6dcad087378c6 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Jul 2022 11:00:05 -0700 Subject: [PATCH 2/2] Reverse order of notification users lists Should show newest first --- bookwyrm/models/notification.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bookwyrm/models/notification.py b/bookwyrm/models/notification.py index 921174924..b0b75a169 100644 --- a/bookwyrm/models/notification.py +++ b/bookwyrm/models/notification.py @@ -300,8 +300,10 @@ def notify_user_on_follow(sender, instance, created, *args, **kwargs): notification.read = False notification.save() else: + # Only group unread follows Notification.notify( instance.user_object, instance.user_subject, notification_type=Notification.FOLLOW, + read=False, )