dont show premium ad if in rog with premium

This commit is contained in:
Kyle Spearrin 2018-07-24 10:44:52 -04:00
parent c05442dea8
commit 105a7870bf
1 changed files with 11 additions and 1 deletions

View File

@ -83,7 +83,7 @@ export class VaultComponent implements OnInit {
this.showUpdateKey = !hasEncKey;
const isPremium = await this.tokenService.getPremium();
this.showPremiumCallout = !this.showVerifyEmail && !isPremium &&
!this.platformUtilsService.isSelfHost();
!this.platformUtilsService.isSelfHost() && !this.inOrgWithPremium();
this.route.queryParams.subscribe(async (params) => {
await this.syncService.fullSync(false);
@ -443,4 +443,14 @@ export class VaultComponent implements OnInit {
const url = this.router.createUrlTree(['vault'], { queryParams: queryParams }).toString();
this.location.go(url);
}
private async inOrgWithPremium() {
const orgs = await this.userService.getAllOrganizations();
for (let i = 0; i < orgs.length; i++) {
if (orgs[i].usersGetPremium) {
return true;
}
}
return false;
}
}