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

[PM-19713][BEEEP] Improve performance of whether user can view subsc… (#14062)

This commit is contained in:
Jonas Hendrickx
2025-04-07 17:00:19 +02:00
committed by GitHub
parent 254cad29b3
commit 38f193ee6c

View File

@@ -68,15 +68,18 @@ export class DefaultBillingAccountProfileStateService implements BillingAccountP
this.hasPremiumFromAnyOrganization$(userId), this.hasPremiumFromAnyOrganization$(userId),
]).pipe( ]).pipe(
concatMap(async ([hasPremiumPersonally, hasPremiumFromOrg]) => { concatMap(async ([hasPremiumPersonally, hasPremiumFromOrg]) => {
const isCloud = !this.platformUtilsService.isSelfHost(); if (hasPremiumPersonally === true || !hasPremiumFromOrg === true) {
return true;
let billing = null;
if (isCloud) {
billing = await this.apiService.getUserBillingHistory();
} }
const cloudAndBillingHistory = isCloud && !billing?.hasNoHistory; const isCloud = !this.platformUtilsService.isSelfHost();
return hasPremiumPersonally || !hasPremiumFromOrg || cloudAndBillingHistory;
if (isCloud) {
const billing = await this.apiService.getUserBillingHistory();
return !billing?.hasNoHistory;
}
return false;
}), }),
); );
} }