fix(federation): 🐛 Update user processing to not refetch user when its data is already available

This commit is contained in:
Jesse Wierzbinski 2025-03-30 21:02:36 +02:00
parent c9a1581932
commit 757c227f00
No known key found for this signature in database

View file

@ -555,16 +555,17 @@ export class InboxProcessor {
*/ */
private async processUserRequest(): Promise<Response | null> { private async processUserRequest(): Promise<Response | null> {
const user = this.body as unknown as VersiaUser; 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 instance = await Instance.resolve(new URL(user.uri));
const updatedAccount = await User.fetchFromRemote(new URL(user.uri));
if (!updatedAccount) { if (!instance) {
return Response.json( return Response.json(
{ error: "Failed to update user" }, { error: "Instance not found" },
{ status: 500 }, { status: 404 },
); );
} }
await User.fromVersia(user, instance);
return null; return null;
} }