Tweak remote actor deletion

This commit is contained in:
Thomas Sileo 2022-08-19 09:41:15 +02:00
parent 32e3a6dbf7
commit 6f9d9d7d9d
2 changed files with 4 additions and 1 deletions

View file

@ -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:

View file

@ -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