From 0c842b29732f37f5f53909c1aa00f7f7bd7b3d87 Mon Sep 17 00:00:00 2001 From: Brandon Treston Date: Fri, 15 Aug 2025 10:57:49 -0400 Subject: [PATCH] remove Object.assign (#16032) --- .../common/collections/models/collection.ts | 21 ++++++++++++------- .../collections/models/collection.view.ts | 11 ++++++---- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/libs/admin-console/src/common/collections/models/collection.ts b/libs/admin-console/src/common/collections/models/collection.ts index 196b15ef5e9..7de4462b0c8 100644 --- a/libs/admin-console/src/common/collections/models/collection.ts +++ b/libs/admin-console/src/common/collections/models/collection.ts @@ -55,14 +55,19 @@ export class Collection extends Domain { encryptService: EncryptService, orgKey: OrgKey, ): Promise { - return Object.assign( - new Collection({ - name: await encryptService.encryptString(view.name, orgKey), - id: view.id, - organizationId: view.organizationId, - }), - view, - ); + const collection = new Collection({ + name: await encryptService.encryptString(view.name, orgKey), + id: view.id, + organizationId: view.organizationId, + }); + + collection.externalId = view.externalId; + collection.readOnly = view.readOnly; + collection.hidePasswords = view.hidePasswords; + collection.manage = view.manage; + collection.type = view.type; + + return collection; } decrypt(orgKey: OrgKey, encryptService: EncryptService): Promise { diff --git a/libs/admin-console/src/common/collections/models/collection.view.ts b/libs/admin-console/src/common/collections/models/collection.view.ts index d8039820845..c4470fe13fb 100644 --- a/libs/admin-console/src/common/collections/models/collection.view.ts +++ b/libs/admin-console/src/common/collections/models/collection.view.ts @@ -102,12 +102,15 @@ export class CollectionView implements View, ITreeNodeObject { encryptService: EncryptService, key: OrgKey, ): Promise { - const view: CollectionView = Object.assign( - new CollectionView({ ...collection, name: "" }), - collection, - ); + const view = new CollectionView({ ...collection, name: "" }); + view.name = await encryptService.decryptString(collection.name, key); view.assigned = true; + view.externalId = collection.externalId; + view.readOnly = collection.readOnly; + view.hidePasswords = collection.hidePasswords; + view.manage = collection.manage; + view.type = collection.type; return view; }