1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +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),
]).pipe(
concatMap(async ([hasPremiumPersonally, hasPremiumFromOrg]) => {
const isCloud = !this.platformUtilsService.isSelfHost();
let billing = null;
if (isCloud) {
billing = await this.apiService.getUserBillingHistory();
if (hasPremiumPersonally === true || !hasPremiumFromOrg === true) {
return true;
}
const cloudAndBillingHistory = isCloud && !billing?.hasNoHistory;
return hasPremiumPersonally || !hasPremiumFromOrg || cloudAndBillingHistory;
const isCloud = !this.platformUtilsService.isSelfHost();
if (isCloud) {
const billing = await this.apiService.getUserBillingHistory();
return !billing?.hasNoHistory;
}
return false;
}),
);
}