mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix(federation): 🐛 Update user processing to not refetch user when its data is already available
This commit is contained in:
parent
c9a1581932
commit
757c227f00
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue