From 105a7870bf413d99bf0c45db5c1c42812cdd1ace Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 24 Jul 2018 10:44:52 -0400 Subject: [PATCH] dont show premium ad if in rog with premium --- src/app/vault/vault.component.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/vault/vault.component.ts b/src/app/vault/vault.component.ts index bcafdc0ee1..24cfa559ad 100644 --- a/src/app/vault/vault.component.ts +++ b/src/app/vault/vault.component.ts @@ -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; + } }