1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

remove Object.assign (#16032)

This commit is contained in:
Brandon Treston
2025-08-15 10:57:49 -04:00
committed by GitHub
parent 7f841a4f06
commit 0c842b2973
2 changed files with 20 additions and 12 deletions

View File

@@ -55,14 +55,19 @@ export class Collection extends Domain {
encryptService: EncryptService,
orgKey: OrgKey,
): Promise<Collection> {
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<CollectionView> {

View File

@@ -102,12 +102,15 @@ export class CollectionView implements View, ITreeNodeObject {
encryptService: EncryptService,
key: OrgKey,
): Promise<CollectionView> {
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;
}