From 63073279e120ff5b8cd749b5d590bcd49c161cde Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Fri, 26 Aug 2022 07:43:39 +0200 Subject: [PATCH] More actor icons --- app/admin.py | 3 +++ app/boxes.py | 1 + app/scss/main.scss | 7 +++++++ app/templates/admin_direct_messages.html | 4 +++- app/templates/index.html | 2 +- app/templates/notifications.html | 2 +- app/templates/utils.html | 8 +++++++- 7 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/admin.py b/app/admin.py index 4300613..13d49bb 100644 --- a/app/admin.py +++ b/app/admin.py @@ -776,6 +776,8 @@ async def admin_profile( actor_id: str, db_session: AsyncSession = Depends(get_db_session), ) -> templates.TemplateResponse: + # TODO: pagination + show featured/pinned + actor = ( await db_session.execute( select(models.Actor).where(models.Actor.ap_id == actor_id) @@ -809,6 +811,7 @@ async def admin_profile( joinedload(models.InboxObject.actor), ) .order_by(models.InboxObject.ap_published_at.desc()) + .limit(20) ) ) .unique() diff --git a/app/boxes.py b/app/boxes.py index 0b1d59c..ca80966 100644 --- a/app/boxes.py +++ b/app/boxes.py @@ -1721,6 +1721,7 @@ async def _process_transient_object( raw_object: ap.RawObject, from_actor: models.Actor, ) -> None: + # TODO: track featured/pinned objects for actors ap_type = raw_object["type"] if ap_type in ["Add", "Remove"]: logger.info(f"Dropping unsupported {ap_type} object") diff --git a/app/scss/main.scss b/app/scss/main.scss index 1c37459..5145c3e 100644 --- a/app/scss/main.scss +++ b/app/scss/main.scss @@ -202,6 +202,13 @@ footer { margin: 0; } } +.tiny-actor-icon { + max-width: 24px; + max-height: 24px; + margin-right: 5px; + position: relative; + top: 5px; +} .actor-box { display: flex; column-gap: 20px; diff --git a/app/templates/admin_direct_messages.html b/app/templates/admin_direct_messages.html index 5ab99d8..38bc994 100644 --- a/app/templates/admin_direct_messages.html +++ b/app/templates/admin_direct_messages.html @@ -10,7 +10,9 @@ {% for anybox_object, convo, actors in threads %}
With {% for actor in actors %} - {{ actor.handle }} + + {{ utils.display_tiny_actor_icon(actor) }} {{ actor.handle }} + {% endfor %}
{{ utils.display_object(anybox_object) }} diff --git a/app/templates/index.html b/app/templates/index.html index 3510c1e..4d0bcfe 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -29,7 +29,7 @@ {% if outbox_object.ap_type in ["Note", "Article", "Video", "Question"] %} {{ utils.display_object(outbox_object) }} {% elif outbox_object.ap_type == "Announce" %} -
{{ local_actor.display_name }} shared
+
{{ utils.display_tiny_actor_icon(local_actor) }} {{ local_actor.display_name | clean_html(local_actor) | safe }} shared
{{ utils.display_object(outbox_object.relates_to_anybox_object) }} {% endif %} {% endfor %} diff --git a/app/templates/notifications.html b/app/templates/notifications.html index a67c782..7f6277b 100644 --- a/app/templates/notifications.html +++ b/app/templates/notifications.html @@ -7,7 +7,7 @@ {% macro notif_actor_action(notif, text) %}
- {{ notif.actor.display_name | clean_html(notif.actor) | safe }} {{ text }} + {{ utils.display_tiny_actor_icon(notif.actor) }} {{ notif.actor.display_name | clean_html(notif.actor) | safe }} {{ text }} {{ notif.created_at | timeago }}
{% endmacro %} diff --git a/app/templates/utils.html b/app/templates/utils.html index 1c24362..ea5aaf4 100644 --- a/app/templates/utils.html +++ b/app/templates/utils.html @@ -180,9 +180,15 @@ {% endmacro %} +{% macro display_tiny_actor_icon(actor) %} + {{ actor.display_name }}'s avatar +{% endmacro %} + {% macro actor_action(inbox_object, text) %}
- {{ inbox_object.actor.display_name | clean_html(inbox_object.actor) | safe }} {{ text }} + + {{ display_tiny_actor_icon(inbox_object.actor) }} {{ inbox_object.actor.display_name | clean_html(inbox_object.actor) | safe }} + {{ text }} {{ inbox_object.ap_published_at | timeago }}