From 4e6e9d803eb1e029dc6f8337bab2a00c620b7302 Mon Sep 17 00:00:00 2001 From: southfox Date: Thu, 27 Apr 2023 11:17:20 +0800 Subject: [PATCH] [fix] undo follow --- app/boxes.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/boxes.py b/app/boxes.py index 00260e8..1edb24a 100644 --- a/app/boxes.py +++ b/app/boxes.py @@ -90,18 +90,25 @@ async def save_incoming( async def process_incoming( db_session: AsyncSession, - ap_object: dict, + ap_object: dict[str, Any], ) -> bool: actor = await fetch_actor(db_session, ap_object["actor"]) relates_to_inbox_object = None relates_to_outbox_object = None - if ap_object["object"].startswith(BASE_URL): - relates_to_outbox_object = await get_outbox_object( - db_session, - ap_object["object"], - ) + if isinstance(ap_object["object"], dict): + if ap_object["object"]["id"].startswith(BASE_URL): + relates_to_outbox_object = await get_outbox_object( + db_session, + ap_object["object"]["id"], + ) + else: + if ap_object["object"].startswith(BASE_URL): + relates_to_outbox_object = await get_outbox_object( + db_session, + ap_object["object"], + ) def build_object( object,