refactor updating actor and target
This commit is contained in:
parent
0474efc008
commit
75c2c105fb
|
@ -742,18 +742,14 @@ export class ApInboxService {
|
||||||
// fetch the new and old accounts
|
// fetch the new and old accounts
|
||||||
const targetUri = getApHrefNullable(activity.target);
|
const targetUri = getApHrefNullable(activity.target);
|
||||||
if (!targetUri) return 'skip: invalid activity target';
|
if (!targetUri) return 'skip: invalid activity target';
|
||||||
let newAccount = await this.apPersonService.resolvePerson(targetUri);
|
await Promise.all([
|
||||||
let oldAccount = await this.apPersonService.resolvePerson(actor.uri);
|
this.apPersonService.updatePerson(targetUri),
|
||||||
|
this.apPersonService.updatePerson(actor.uri),
|
||||||
// update them if they're remote
|
]);
|
||||||
if (newAccount.uri) {
|
const [newAccount, oldAccount] = await Promise.all([
|
||||||
await this.apPersonService.updatePerson(newAccount.uri);
|
this.apPersonService.resolvePerson(targetUri),
|
||||||
newAccount = await this.apPersonService.resolvePerson(newAccount.uri);
|
this.apPersonService.resolvePerson(actor.uri),
|
||||||
}
|
]);
|
||||||
if (oldAccount.uri) {
|
|
||||||
await this.apPersonService.updatePerson(oldAccount.uri);
|
|
||||||
oldAccount = await this.apPersonService.resolvePerson(oldAccount.uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if alsoKnownAs of the new account is valid
|
// check if alsoKnownAs of the new account is valid
|
||||||
let isValidMove = true;
|
let isValidMove = true;
|
||||||
|
|
Loading…
Reference in New Issue