From 2fba922e037f43337fb9ab01802e13a5dff1262d Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 31 Jul 2022 15:00:06 +0200 Subject: [PATCH] Improve notifications page --- app/templates/notifications.html | 43 ++++++++++++-------------------- app/templates/utils.html | 2 +- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/app/templates/notifications.html b/app/templates/notifications.html index 412d77f..3eac45f 100644 --- a/app/templates/notifications.html +++ b/app/templates/notifications.html @@ -5,6 +5,13 @@ {{ local_actor.display_name }} - Notifications {% endblock %} +{% macro notif_actor_action(notif, text) %} +
+ {{ notif.actor.display_name | clean_html(notif.actor) | safe }} {{ text }} + {{ notif.created_at | timeago }} +
+{% endmacro %} + {% block content %}

Notifications

@@ -13,49 +20,31 @@ {%- for notif in notifications %}
{%- if notif.notification_type.value == "new_follower" %} - + {{ notif_actor_action(notif, "followed you") }} {{ utils.display_actor(notif.actor, actors_metadata) }} {% elif notif.notification_type.value == "unfollow" %} -
- {{ notif.actor.display_name }} unfollowed you -
+ {{ notif_actor_action(notif, "unfollowed you") }} {{ utils.display_actor(notif.actor, actors_metadata) }} {%- elif notif.notification_type.value == "follow_request_accepted" %} -
- {{ notif.actor.display_name }} accepted your follow request -
+ {{ notif_actor_action(notif, "accepted your follow request") }} {{ utils.display_actor(notif.actor, actors_metadata) }} {%- elif notif.notification_type.value == "follow_request_rejected" %} -
- {{ notif.actor.display_name }} rejected your follow request -
+ {{ notif_actor_action(notif, "rejected your follow request") }} {{ utils.display_actor(notif.actor, actors_metadata) }} {% elif notif.notification_type.value == "like" %} - + {{ notif_actor_action(notif, "liked a post") }} {{ utils.display_object(notif.outbox_object) }} {% elif notif.notification_type.value == "undo_like" %} -
- {{ notif.actor.display_name }} un-liked a post -
+ {{ notif_actor_action(notif, "unliked a post") }} {{ utils.display_object(notif.outbox_object) }} {% elif notif.notification_type.value == "announce" %} -
- {{ notif.actor.display_name }} boosted a post -
+ {{ notif_actor_action(notif, "shared a post") }} {{ utils.display_object(notif.outbox_object) }} {% elif notif.notification_type.value == "undo_announce" %} -
- {{ notif.actor.display_name }} un-boosted a post -
+ {{ notif_actor_action(notif, "unshared a post") }} {{ utils.display_object(notif.outbox_object) }} {% elif notif.notification_type.value == "mention" %} -
- {{ notif.actor.display_name }} mentioned you -
+ {{ notif_actor_action(notif, "mentioned you") }} {{ utils.display_object(notif.inbox_object) }} {% elif notif.notification_type.value == "new_webmention" %}
diff --git a/app/templates/utils.html b/app/templates/utils.html index 5ba2ba5..23951fd 100644 --- a/app/templates/utils.html +++ b/app/templates/utils.html @@ -192,7 +192,7 @@ {% macro actor_action(inbox_object, text) %}
{{ inbox_object.actor.display_name | clean_html(inbox_object.actor) | safe }} {{ text }} - {{ inbox_object.ap_published_at | timeago }} + {{ inbox_object.ap_published_at | timeago }}
{% endmacro %}