From f065343394dbe687d0039f08e018e89fdc7a0d1d Mon Sep 17 00:00:00 2001 From: Lucas Leblow Date: Thu, 4 Apr 2024 11:38:43 -0700 Subject: [PATCH] Fixup --- .../connections-manager.service.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/nest/connections-manager/connections-manager.service.ts b/packages/backend/src/nest/connections-manager/connections-manager.service.ts index 0bd44c4d43..07353b6fa0 100644 --- a/packages/backend/src/nest/connections-manager/connections-manager.service.ts +++ b/packages/backend/src/nest/connections-manager/connections-manager.service.ts @@ -349,7 +349,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI const localAddress = createLibp2pAddress(payload.hiddenService.onionAddress, payload.peerId.id) - const community = { + let community: Community = { id: payload.id, name: payload.name, CA: payload.CA, @@ -372,14 +372,19 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI await this.launchCommunity({ community, network }) - const meta = await this.storageService.updateCommunityMetadata(payload) - const community = await this.localDbService.getCurrentCommunity() + const meta = await this.storageService.updateCommunityMetadata({ + id: community.id, + rootCa: community.rootCa as string, + ownerCertificate: community.ownerCertificate as string, + }) + const currentCommunity = await this.localDbService.getCurrentCommunity() - if (meta && community) { - await this.localDbService.setCommunity({ - ...community, + if (meta && currentCommunity) { + community = { + ...currentCommunity, ownerOrbitDbIdentity: meta.ownerOrbitDbIdentity, - }) + } + await this.localDbService.setCommunity(community) } this.logger(`Created and launched community ${community.id}`)