From 757c227f009f28e2545a0c177a683827a787ec5b Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Sun, 30 Mar 2025 21:02:36 +0200 Subject: [PATCH] fix(federation): :bug: Update user processing to not refetch user when its data is already available --- classes/inbox/processor.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/classes/inbox/processor.ts b/classes/inbox/processor.ts index 5c3e2414..4b643466 100644 --- a/classes/inbox/processor.ts +++ b/classes/inbox/processor.ts @@ -555,16 +555,17 @@ export class InboxProcessor { */ private async processUserRequest(): Promise { const user = this.body as unknown as VersiaUser; - // FIXME: Instead of refetching the remote user, we should read the incoming json and update from that - const updatedAccount = await User.fetchFromRemote(new URL(user.uri)); + const instance = await Instance.resolve(new URL(user.uri)); - if (!updatedAccount) { + if (!instance) { return Response.json( - { error: "Failed to update user" }, - { status: 500 }, + { error: "Instance not found" }, + { status: 404 }, ); } + await User.fromVersia(user, instance); + return null; }