unfollow
This commit is contained in:
parent
5b6f66d156
commit
c03f491008
|
@ -92,6 +92,15 @@ export class AccountMoveService {
|
||||||
const iObj = await this.userEntityService.pack<true, true>(src.id, src, { detail: true, includeSecrets: true });
|
const iObj = await this.userEntityService.pack<true, true>(src.id, src, { detail: true, includeSecrets: true });
|
||||||
this.globalEventService.publishMainStream(src.id, 'meUpdated', iObj);
|
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!
|
// Move!
|
||||||
await this.move(src, dst);
|
await this.move(src, dst);
|
||||||
|
|
||||||
|
|
|
@ -266,13 +266,19 @@ describe('Account Move', () => {
|
||||||
|
|
||||||
await sleep(1000 * 1); // wait for jobs to finish
|
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,
|
userId: carol.id,
|
||||||
}, carol);
|
}, carol);
|
||||||
assert.strictEqual(followings.status, 200);
|
assert.strictEqual(carolFollowings.status, 200);
|
||||||
assert.strictEqual(followings.body.length, 2);
|
assert.strictEqual(carolFollowings.body.length, 2);
|
||||||
assert.strictEqual(followings.body[0].followeeId, bob.id);
|
assert.strictEqual(carolFollowings.body[0].followeeId, bob.id);
|
||||||
assert.strictEqual(followings.body[1].followeeId, alice.id);
|
assert.strictEqual(carolFollowings.body[1].followeeId, alice.id);
|
||||||
|
|
||||||
const blockings = await api('/blocking/list', {}, dave);
|
const blockings = await api('/blocking/list', {}, dave);
|
||||||
assert.strictEqual(blockings.status, 200);
|
assert.strictEqual(blockings.status, 200);
|
||||||
|
|
Loading…
Reference in a new issue