From 6f9d9d7d9dd938c6614736ab7cebe147b0f99870 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Fri, 19 Aug 2022 09:41:15 +0200 Subject: [PATCH] Tweak remote actor deletion --- app/actor.py | 3 ++- app/boxes.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/actor.py b/app/actor.py index 4906edc..049369e 100644 --- a/app/actor.py +++ b/app/actor.py @@ -178,11 +178,12 @@ async def fetch_actor( await db_session.scalars( select(models.Actor).where( models.Actor.ap_id == actor_id, - models.Actor.is_deleted.is_(False), ) ) ).one_or_none() if existing_actor: + if existing_actor.is_deleted: + raise ap.ObjectNotFoundError(f"{actor_id} was deleted") return existing_actor else: if save_if_not_found: diff --git a/app/boxes.py b/app/boxes.py index 0277f19..af63b47 100644 --- a/app/boxes.py +++ b/app/boxes.py @@ -1735,6 +1735,8 @@ async def save_to_inbox( ) -> None: try: actor = await fetch_actor(db_session, ap.get_id(raw_object["actor"])) + except ap.ObjectNotFoundError: + logger.warning("Actor not found") except httpx.HTTPStatusError: logger.exception("Failed to fetch actor") return