From 04e75c78e06ec9fb74bc54a5b3d4bdfc7040ae2e Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Tue, 15 Nov 2022 21:47:51 +0100 Subject: [PATCH] Handle inbox delete handler for actors --- app/boxes.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/boxes.py b/app/boxes.py index 6b16b26..0f5c7a4 100644 --- a/app/boxes.py +++ b/app/boxes.py @@ -1124,6 +1124,23 @@ async def _handle_delete_activity( logger.info("Removing actor from follower") await db_session.delete(follower) + # Also mark Follow activities for this actor as deleted + follow_activities = ( + await db_session.scalars( + select(models.OutboxObject).where( + models.OutboxObject.ap_type == "Follow", + models.OutboxObject.relates_to_actor_id + == ap_object_to_delete.id, + models.OutboxObject.is_deleted.is_(False), + ) + ) + ).all() + for follow_activity in follow_activities: + logger.info( + f"Marking Follow activity {follow_activity.ap_id} as deleted" + ) + follow_activity.is_deleted = True + following = ( await db_session.scalars( select(models.Following).where(