fix copying mutings
This commit is contained in:
parent
6a2752ef73
commit
71e9b2298e
|
@ -185,7 +185,12 @@ export class AccountMoveService {
|
||||||
@bindThis
|
@bindThis
|
||||||
public async copyMutings(src: ThinUser, dst: ThinUser): Promise<void> {
|
public async copyMutings(src: ThinUser, dst: ThinUser): Promise<void> {
|
||||||
// Insert new mutings with the same values except mutee
|
// Insert new mutings with the same values except mutee
|
||||||
const mutings = await this.mutingsRepository.findBy({ muteeId: src.id });
|
const mutings = await this.mutingsRepository.find({
|
||||||
|
relations: {
|
||||||
|
muter: true,
|
||||||
|
},
|
||||||
|
where: { muteeId: src.id }
|
||||||
|
});
|
||||||
const newMuting: Partial<Muting>[] = [];
|
const newMuting: Partial<Muting>[] = [];
|
||||||
for (const muting of mutings) {
|
for (const muting of mutings) {
|
||||||
newMuting.push({
|
newMuting.push({
|
||||||
|
@ -196,7 +201,7 @@ export class AccountMoveService {
|
||||||
muteeId: dst.id,
|
muteeId: dst.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.mutingsRepository.insert(mutings); // no need to wait
|
await this.mutingsRepository.insert(mutings);
|
||||||
for (const mute of mutings) {
|
for (const mute of mutings) {
|
||||||
if (mute.muter) this.cacheService.userMutingsCache.refresh(mute.muter.id);
|
if (mute.muter) this.cacheService.userMutingsCache.refresh(mute.muter.id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue