Handle inbox delete handler for actors

main
Thomas Sileo 2022-11-15 21:47:51 +01:00
parent 68c27e083f
commit 04e75c78e0
1 changed files with 17 additions and 0 deletions

View File

@ -1124,6 +1124,23 @@ async def _handle_delete_activity(
logger.info("Removing actor from follower") logger.info("Removing actor from follower")
await db_session.delete(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 = ( following = (
await db_session.scalars( await db_session.scalars(
select(models.Following).where( select(models.Following).where(