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; }