mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +00:00
[PM-19713][BEEEP] Improve performance of whether user can view subsc… (#14062)
This commit is contained in:
@@ -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;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user