From 17c80e82e016312fd4cc52641ae58a2e273c72eb Mon Sep 17 00:00:00 2001 From: Namekuji Date: Sat, 15 Apr 2023 01:15:23 -0400 Subject: [PATCH] fix updating account --- packages/backend/src/core/AccountMoveService.ts | 2 ++ packages/backend/src/core/activitypub/ApInboxService.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/core/AccountMoveService.ts b/packages/backend/src/core/AccountMoveService.ts index d239155700..1b89512d01 100644 --- a/packages/backend/src/core/AccountMoveService.ts +++ b/packages/backend/src/core/AccountMoveService.ts @@ -81,6 +81,7 @@ export class AccountMoveService { update.alsoKnownAs = src.alsoKnownAs?.concat([dstUri]) ?? [dstUri]; update.movedToUri = dstUri; await this.usersRepository.update(src.id, update); + src = Object.assign(src, update); const srcPerson = await this.apRendererService.renderPerson(src); const updateAct = this.apRendererService.addContext(this.apRendererService.renderUpdate(srcPerson, src)); @@ -109,6 +110,7 @@ export class AccountMoveService { @bindThis public async createAlias(me: LocalUser, updates: Partial): Promise { await this.usersRepository.update(me.id, updates); + me = Object.assign(me, updates); // Publish meUpdated event const iObj = await this.userEntityService.pack(me.id, me, { diff --git a/packages/backend/src/core/activitypub/ApInboxService.ts b/packages/backend/src/core/activitypub/ApInboxService.ts index 95b41626aa..60539e58ee 100644 --- a/packages/backend/src/core/activitypub/ApInboxService.ts +++ b/packages/backend/src/core/activitypub/ApInboxService.ts @@ -765,7 +765,8 @@ export class ApInboxService { } // add target uri to movedToUri in order to indicate that the user has moved - this.usersRepository.update(oldAccount.id, { movedToUri: targetUri }); + await this.usersRepository.update(oldAccount.id, { movedToUri: targetUri }); + oldAccount.movedToUri = targetUri; // Move! await this.accountMoveService.move(oldAccount, newAccount);