From 1af1bc87bd58e7655e72473fd82c21394f52a0a0 Mon Sep 17 00:00:00 2001 From: tamaina Date: Mon, 4 Mar 2024 10:05:45 +0000 Subject: [PATCH] use save --- .../src/core/activitypub/models/ApPersonService.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts index 983bf0ebc5..a977c9251d 100644 --- a/packages/backend/src/core/activitypub/models/ApPersonService.ts +++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts @@ -558,12 +558,11 @@ export class ApPersonService implements OnModuleInit { (person.additionalPublicKeys ?? []).forEach(key => publicKeys.set(key.id, key)); publicKeys.set(person.publicKey.id, person.publicKey); - for (const key of publicKeys.values()) { - await this.userPublickeysRepository.update({ keyId: key.id }, { - userId: exist.id, - keyPem: key.publicKeyPem, - }); - } + await this.userPublickeysRepository.save(Array.from(publicKeys.values(), key => ({ + keyId: key.id, + userId: exist.id, + keyPem: key.publicKeyPem, + }))); } this.userPublickeysRepository.delete({