From 1f6d6c5477eb77cf858b40c7d4c3b58093cb3e1a Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Tue, 5 Jul 2022 08:33:39 +0200 Subject: [PATCH] More fixes (from the test instance) --- app/admin.py | 4 +++- app/boxes.py | 3 ++- app/templates/admin_inbox.html | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/admin.py b/app/admin.py index f738c5c..c9f4c05 100644 --- a/app/admin.py +++ b/app/admin.py @@ -211,7 +211,9 @@ async def admin_inbox( ( await db_session.scalars( q.options( - joinedload(models.InboxObject.relates_to_inbox_object), + joinedload(models.InboxObject.relates_to_inbox_object).options( + joinedload(models.InboxObject.actor) + ), joinedload(models.InboxObject.relates_to_outbox_object).options( joinedload( models.OutboxObject.outbox_object_attachments diff --git a/app/boxes.py b/app/boxes.py index bced23a..8e6235e 100644 --- a/app/boxes.py +++ b/app/boxes.py @@ -886,6 +886,7 @@ async def get_replies_tree( select(models.InboxObject) .where( models.InboxObject.ap_context == requested_object.ap_context, + models.InboxObject.ap_type.not_in(["Announce"]), ) .options(joinedload(models.InboxObject.actor)) ) @@ -917,7 +918,7 @@ async def get_replies_tree( logger.info(nodes_by_in_reply_to) if len(nodes_by_in_reply_to.get(None, [])) > 1: - raise ValueError("Invalid replies tree") + raise ValueError(f"Invalid replies tree: {[n.ap_object for n in tree_nodes]}") def _get_reply_node_children( node: ReplyTreeNode, diff --git a/app/templates/admin_inbox.html b/app/templates/admin_inbox.html index a61ff5b..dff7bd7 100644 --- a/app/templates/admin_inbox.html +++ b/app/templates/admin_inbox.html @@ -14,7 +14,7 @@ {% for inbox_object in inbox %} {% if inbox_object.ap_type == "Announce" %} - {{ actor_action(inbox_object, "shared one of your post") }} + {{ actor_action(inbox_object, "shared") }} {{ utils.display_object(inbox_object.relates_to_anybox_object) }} {% elif inbox_object.ap_type in ["Article", "Note", "Video"] %} {{ utils.display_object(inbox_object) }}