diff --git a/packages/backend/src/core/AccountMoveService.ts b/packages/backend/src/core/AccountMoveService.ts index 017e2d7e58..b9c38411c9 100644 --- a/packages/backend/src/core/AccountMoveService.ts +++ b/packages/backend/src/core/AccountMoveService.ts @@ -92,6 +92,15 @@ export class AccountMoveService { const iObj = await this.userEntityService.pack(src.id, src, { detail: true, includeSecrets: true }); this.globalEventService.publishMainStream(src.id, 'meUpdated', iObj); + // Unfollow + const followings = await this.followingsRepository.findBy({ + followeeId: src.id, + }); + this.queueService.createUnfollowJob(followings.map(following => ({ + from: { id: src.id }, + to: { id: following.followerId }, + }))); + // Move! await this.move(src, dst); diff --git a/packages/backend/test/e2e/move.ts b/packages/backend/test/e2e/move.ts index 2a49402aa7..740d634a2c 100644 --- a/packages/backend/test/e2e/move.ts +++ b/packages/backend/test/e2e/move.ts @@ -266,13 +266,19 @@ describe('Account Move', () => { await sleep(1000 * 1); // wait for jobs to finish - const followings = await api('/users/following', { + const aliceFollowings = await api('/users/following', { + userId: alice.id, + }, alice); + assert.strictEqual(aliceFollowings.status, 200); + assert.strictEqual(aliceFollowings.body.length, 0); + + const carolFollowings = await api('/users/following', { userId: carol.id, }, carol); - assert.strictEqual(followings.status, 200); - assert.strictEqual(followings.body.length, 2); - assert.strictEqual(followings.body[0].followeeId, bob.id); - assert.strictEqual(followings.body[1].followeeId, alice.id); + assert.strictEqual(carolFollowings.status, 200); + assert.strictEqual(carolFollowings.body.length, 2); + assert.strictEqual(carolFollowings.body[0].followeeId, bob.id); + assert.strictEqual(carolFollowings.body[1].followeeId, alice.id); const blockings = await api('/blocking/list', {}, dave); assert.strictEqual(blockings.status, 200);