From 4ae198d074696712abac7b1517b36e1d08b0837f Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Mon, 15 Aug 2022 22:22:15 +0200 Subject: [PATCH] Fix actor lookup --- app/admin.py | 2 +- app/lookup.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/admin.py b/app/admin.py index 90ae62b..2dc84b8 100644 --- a/app/admin.py +++ b/app/admin.py @@ -103,7 +103,7 @@ async def get_lookup( await fetch_actor( db_session, ap_object.ap_id, save_if_not_found=False ) - except ap.NotAnObjectError: + except ap.ObjectNotFoundError: pass else: return RedirectResponse( diff --git a/app/lookup.py b/app/lookup.py index a3f05d6..84af030 100644 --- a/app/lookup.py +++ b/app/lookup.py @@ -3,7 +3,7 @@ import mf2py # type: ignore from app import activitypub as ap from app import webfinger from app.actor import Actor -from app.actor import fetch_actor +from app.actor import RemoteActor from app.ap_object import RemoteObject from app.database import AsyncSession @@ -34,7 +34,6 @@ async def lookup(db_session: AsyncSession, query: str) -> Actor | RemoteObject: raise if ap.as_list(ap_obj["type"])[0] in ap.ACTOR_TYPES: - actor = await fetch_actor(db_session, ap_obj["id"]) - return actor + return RemoteActor(ap_obj) else: return await RemoteObject.from_raw_object(ap_obj)