don't mute users who are already followed
This commit is contained in:
parent
be3c911e48
commit
5003557e90
1 changed files with 7 additions and 3 deletions
|
|
@ -201,9 +201,12 @@ export class AccountMoveService {
|
|||
if (oldMutings.length === 0) return;
|
||||
|
||||
// Check if the destination account is already indefinitely muted by the muter
|
||||
const existingMutingsMuterUserIds = await this.mutingsRepository.findBy(
|
||||
{ muteeId: dst.id, expiresAt: IsNull() },
|
||||
).then(mutings => mutings.map(muting => muting.muterId));
|
||||
const [existingMutingsMuterUserIds, dstFollowers] = await Promise.all([
|
||||
this.mutingsRepository.findBy(
|
||||
{ muteeId: dst.id, expiresAt: IsNull() },
|
||||
).then(mutings => mutings.map(muting => muting.muterId)),
|
||||
this.cacheService.userFollowersCache.fetch(dst.id),
|
||||
]);
|
||||
|
||||
const newMutings: Map<string, { muterId: string; muteeId: string; expiresAt: Date | null; }> = new Map();
|
||||
|
||||
|
|
@ -217,6 +220,7 @@ export class AccountMoveService {
|
|||
};
|
||||
for (const muting of oldMutings) {
|
||||
if (existingMutingsMuterUserIds.includes(muting.muterId)) continue; // skip if already muted indefinitely
|
||||
if (dstFollowers.has(muting.muterId)) continue; // skip if already following
|
||||
newMutings.set(genId(), {
|
||||
...muting,
|
||||
muteeId: dst.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue