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

[PM-19244] add missing null check, fix feature flag logic, cleanup (#13850)

* add missing null check, fix feature flag logic, cleanup

* add null check
This commit is contained in:
Brandon Treston
2025-03-18 16:42:02 -04:00
committed by GitHub
parent 17a60d0226
commit 69b2972e56

View File

@@ -219,23 +219,24 @@ export class VaultHeaderComponent implements OnInit {
} }
async addCollection(): Promise<void> { async addCollection(): Promise<void> {
const organization = this.organizations?.find(
(org) => org.productTierType === ProductTierType.Free,
);
const isBreadcrumbEventLogsEnabled = await firstValueFrom( const isBreadcrumbEventLogsEnabled = await firstValueFrom(
this.configService.getFeatureFlag$(FeatureFlag.PM12276_BreadcrumbEventLogs), this.configService.getFeatureFlag$(FeatureFlag.PM12276_BreadcrumbEventLogs),
); );
if (
this.organizations.length == 1 && if (isBreadcrumbEventLogsEnabled) {
organization.productTierType === ProductTierType.Free && const organization = this.organizations?.find(
isBreadcrumbEventLogsEnabled (org) => org.productTierType === ProductTierType.Free,
) { );
const collections = await this.collectionAdminService.getAll(organization.id);
if (collections.length === organization.maxCollections) { if (this.organizations?.length == 1 && !!organization) {
await this.showFreeOrgUpgradeDialog(organization); const collections = await this.collectionAdminService.getAll(organization.id);
return; if (collections.length === organization.maxCollections) {
await this.showFreeOrgUpgradeDialog(organization);
return;
}
} }
} }
this.onAddCollection.emit(); this.onAddCollection.emit();
} }