mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
[PM-14289] - vault cipher form - set default owner as organization from collection when possible (#12682)
* set default org by referencing collecction * get organizationId from collection * always get organizationId from collection when possible
This commit is contained in:
@@ -779,16 +779,26 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
null,
|
null,
|
||||||
cipherType,
|
cipherType,
|
||||||
);
|
);
|
||||||
|
const collectionId =
|
||||||
|
this.activeFilter.collectionId !== "AllCollections" && this.activeFilter.collectionId != null
|
||||||
|
? this.activeFilter.collectionId
|
||||||
|
: null;
|
||||||
|
let organizationId =
|
||||||
|
this.activeFilter.organizationId !== "MyVault" && this.activeFilter.organizationId != null
|
||||||
|
? this.activeFilter.organizationId
|
||||||
|
: null;
|
||||||
|
// Attempt to get the organization ID from the collection if present
|
||||||
|
if (collectionId) {
|
||||||
|
const organizationIdFromCollection = (
|
||||||
|
await firstValueFrom(this.vaultFilterService.filteredCollections$)
|
||||||
|
).find((c) => c.id === this.activeFilter.collectionId)?.organizationId;
|
||||||
|
if (organizationIdFromCollection) {
|
||||||
|
organizationId = organizationIdFromCollection;
|
||||||
|
}
|
||||||
|
}
|
||||||
cipherFormConfig.initialValues = {
|
cipherFormConfig.initialValues = {
|
||||||
organizationId:
|
organizationId: organizationId as OrganizationId,
|
||||||
this.activeFilter.organizationId !== "MyVault" && this.activeFilter.organizationId != null
|
collectionIds: [collectionId as CollectionId],
|
||||||
? (this.activeFilter.organizationId as OrganizationId)
|
|
||||||
: null,
|
|
||||||
collectionIds:
|
|
||||||
this.activeFilter.collectionId !== "AllCollections" &&
|
|
||||||
this.activeFilter.collectionId != null
|
|
||||||
? [this.activeFilter.collectionId as CollectionId]
|
|
||||||
: [],
|
|
||||||
folderId: this.activeFilter.folderId,
|
folderId: this.activeFilter.folderId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user