This commit is contained in:
tamaina 2023-04-22 09:36:27 +00:00
parent 5b6f66d156
commit c03f491008
2 changed files with 20 additions and 5 deletions

View file

@ -92,6 +92,15 @@ export class AccountMoveService {
const iObj = await this.userEntityService.pack<true, true>(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);

View file

@ -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);