mirror of
https://github.com/bitwarden/browser
synced 2025-01-26 11:15:03 +01: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:
parent
4d576f0533
commit
38c1cdfb62
@ -779,16 +779,26 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||
null,
|
||||
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 = {
|
||||
organizationId:
|
||||
this.activeFilter.organizationId !== "MyVault" && this.activeFilter.organizationId != null
|
||||
? (this.activeFilter.organizationId as OrganizationId)
|
||||
: null,
|
||||
collectionIds:
|
||||
this.activeFilter.collectionId !== "AllCollections" &&
|
||||
this.activeFilter.collectionId != null
|
||||
? [this.activeFilter.collectionId as CollectionId]
|
||||
: [],
|
||||
organizationId: organizationId as OrganizationId,
|
||||
collectionIds: [collectionId as CollectionId],
|
||||
folderId: this.activeFilter.folderId,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user