fix checking alsoKnownAs and uri

This commit is contained in:
Namekuji 2023-04-15 00:47:01 -04:00
parent 33851fbab6
commit 0e088cb2e4
2 changed files with 15 additions and 10 deletions

View file

@ -74,12 +74,12 @@ export class AccountMoveService {
*/
@bindThis
public async moveFromLocal(src: LocalUser, dst: User): Promise<unknown> {
if (!dst.uri) throw new Error('destination uri is empty');
const dstUri = this.getUserUri(dst);
// add movedToUri to indicate that the user has moved
const update = {} as Partial<User>;
update.alsoKnownAs = src.alsoKnownAs?.concat([dst.uri]) ?? [dst.uri];
update.movedToUri = dst.uri;
update.alsoKnownAs = src.alsoKnownAs?.concat([dstUri]) ?? [dstUri];
update.movedToUri = dstUri;
await this.usersRepository.update(src.id, update);
const srcPerson = await this.apRendererService.renderPerson(src);