Merge pull request 'fix: retrieve remote user again when migrating' (#9826) from nmkj/calckey:fix-alsoknownas into develop

Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9826
This commit is contained in:
Kainoa Kanter 2023-04-08 06:15:27 +00:00
commit 5f6358c4bd

View file

@ -19,14 +19,18 @@ export default async (
// 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 "move: target uri is null"; if (!targetUri) return "move: target uri is null";
const new_acc = await resolvePerson(targetUri); let new_acc = await resolvePerson(targetUri);
if (!actor.uri) return "move: actor uri is null"; if (!actor.uri) return "move: actor uri is null";
const old_acc = await resolvePerson(actor.uri); let old_acc = await resolvePerson(actor.uri);
// update them if they're remote // update them if they're remote
if (new_acc.uri) await updatePerson(new_acc.uri); if (new_acc.uri) await updatePerson(new_acc.uri);
if (old_acc.uri) await updatePerson(old_acc.uri); if (old_acc.uri) await updatePerson(old_acc.uri);
// retrieve updated users
new_acc = await resolvePerson(targetUri);
old_acc = await resolvePerson(actor.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;
if (old_acc.uri) { if (old_acc.uri) {