skip if no need to adjust
This commit is contained in:
parent
942d5b6672
commit
aaf098f697
|
@ -232,9 +232,11 @@ export class AccountMoveService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async adjustFollowingCounts(localFollowerIds: string[], oldAccount: User) {
|
private async adjustFollowingCounts(localFollowerIds: string[], oldAccount: User): Promise<void> {
|
||||||
|
if (localFollowerIds.length === 0) return;
|
||||||
|
|
||||||
// Set the old account's following and followers counts to 0.
|
// Set the old account's following and followers counts to 0.
|
||||||
await this.usersRepository.update(oldAccount.id, { followersCount: 0, followingCount: 0 });
|
await this.usersRepository.update({ id: oldAccount.id }, { followersCount: 0, followingCount: 0 });
|
||||||
|
|
||||||
// Decrease following counts of local followers by 1.
|
// Decrease following counts of local followers by 1.
|
||||||
await this.usersRepository.decrement({ id: In(localFollowerIds) }, 'followingCount', 1);
|
await this.usersRepository.decrement({ id: In(localFollowerIds) }, 'followingCount', 1);
|
||||||
|
|
Loading…
Reference in a new issue