no need to care promise orders
This commit is contained in:
parent
91fcad0c85
commit
0474efc008
|
@ -118,14 +118,12 @@ export class AccountMoveService {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async move(src: User, dst: User): Promise<void> {
|
public async move(src: User, dst: User): Promise<void> {
|
||||||
// Copy blockings:
|
// Copy blockings and mutings, and update lists
|
||||||
await this.copyBlocking(src, dst);
|
await Promise.all([
|
||||||
|
this.copyBlocking(src, dst),
|
||||||
// Copy mutings:
|
this.copyMutings(src, dst),
|
||||||
await this.copyMutings(src, dst);
|
this.updateLists(src, dst),
|
||||||
|
]);
|
||||||
// Update lists:
|
|
||||||
await this.updateLists(src, dst);
|
|
||||||
|
|
||||||
// follow the new account and unfollow the old one
|
// follow the new account and unfollow the old one
|
||||||
const followings = await this.followingsRepository.find({
|
const followings = await this.followingsRepository.find({
|
||||||
|
@ -195,9 +193,13 @@ export class AccountMoveService {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async updateLists(src: ThinUser, dst: User): Promise<void> {
|
public async updateLists(src: ThinUser, dst: User): Promise<void> {
|
||||||
// Return if there is no list to be updated
|
// Return if there is no list to be updated.
|
||||||
const numOfLists = await this.userListJoiningsRepository.countBy({ userId: src.id });
|
const exists = await this.userListJoiningsRepository.exist({
|
||||||
if (numOfLists === 0) return;
|
where: {
|
||||||
|
userId: src.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!exists) return;
|
||||||
|
|
||||||
await this.userListJoiningsRepository.update(
|
await this.userListJoiningsRepository.update(
|
||||||
{ userId: src.id },
|
{ userId: src.id },
|
||||||
|
|
|
@ -533,9 +533,11 @@ export class ApPersonService implements OnModuleInit {
|
||||||
const newAccount = await this.resolvePerson(updates.movedToUri);
|
const newAccount = await this.resolvePerson(updates.movedToUri);
|
||||||
// Aggressively block and/or mute the new account:
|
// Aggressively block and/or mute the new account:
|
||||||
// This does NOT check alsoKnownAs, assuming that other implmenetations properly check alsoKnownAs when firing account migration
|
// This does NOT check alsoKnownAs, assuming that other implmenetations properly check alsoKnownAs when firing account migration
|
||||||
await this.accountMoveService.copyBlocking(exist, newAccount);
|
await Promise.all([
|
||||||
await this.accountMoveService.copyMutings(exist, newAccount);
|
this.accountMoveService.copyBlocking(exist, newAccount),
|
||||||
await this.accountMoveService.updateLists(exist, newAccount);
|
this.accountMoveService.copyMutings(exist, newAccount),
|
||||||
|
this.accountMoveService.updateLists(exist, newAccount),
|
||||||
|
]);
|
||||||
} catch {
|
} catch {
|
||||||
/* skip if any error happens */
|
/* skip if any error happens */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue