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, ) 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]