mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 13:14:28 +00:00
Tweak remote actor deletion
This commit is contained in:
parent
32e3a6dbf7
commit
6f9d9d7d9d
2 changed files with 4 additions and 1 deletions
|
@ -178,11 +178,12 @@ async def fetch_actor(
|
||||||
await db_session.scalars(
|
await db_session.scalars(
|
||||||
select(models.Actor).where(
|
select(models.Actor).where(
|
||||||
models.Actor.ap_id == actor_id,
|
models.Actor.ap_id == actor_id,
|
||||||
models.Actor.is_deleted.is_(False),
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
).one_or_none()
|
).one_or_none()
|
||||||
if existing_actor:
|
if existing_actor:
|
||||||
|
if existing_actor.is_deleted:
|
||||||
|
raise ap.ObjectNotFoundError(f"{actor_id} was deleted")
|
||||||
return existing_actor
|
return existing_actor
|
||||||
else:
|
else:
|
||||||
if save_if_not_found:
|
if save_if_not_found:
|
||||||
|
|
|
@ -1735,6 +1735,8 @@ async def save_to_inbox(
|
||||||
) -> None:
|
) -> None:
|
||||||
try:
|
try:
|
||||||
actor = await fetch_actor(db_session, ap.get_id(raw_object["actor"]))
|
actor = await fetch_actor(db_session, ap.get_id(raw_object["actor"]))
|
||||||
|
except ap.ObjectNotFoundError:
|
||||||
|
logger.warning("Actor not found")
|
||||||
except httpx.HTTPStatusError:
|
except httpx.HTTPStatusError:
|
||||||
logger.exception("Failed to fetch actor")
|
logger.exception("Failed to fetch actor")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue