1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-06 09:20:43 +01:00

sync after premium/org purchase

This commit is contained in:
Kyle Spearrin 2018-07-05 08:39:22 -04:00
parent 32f62b7ceb
commit b97378dd40
3 changed files with 15 additions and 6 deletions

View File

@ -14,6 +14,7 @@ import { ApiService } from 'jslib/abstractions/api.service';
import { CryptoService } from 'jslib/abstractions/crypto.service'; import { CryptoService } from 'jslib/abstractions/crypto.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { SyncService } from 'jslib/abstractions/sync.service';
import { PaymentComponent } from './payment.component'; import { PaymentComponent } from './payment.component';
@ -82,7 +83,7 @@ export class CreateOrganizationComponent {
constructor(private apiService: ApiService, private i18nService: I18nService, constructor(private apiService: ApiService, private i18nService: I18nService,
private analytics: Angulartics2, private toasterService: ToasterService, private analytics: Angulartics2, private toasterService: ToasterService,
platformUtilsService: PlatformUtilsService, private cryptoService: CryptoService, platformUtilsService: PlatformUtilsService, private cryptoService: CryptoService,
private router: Router) { private router: Router, private syncService: SyncService) {
this.selfHosted = platformUtilsService.isSelfHost(); this.selfHosted = platformUtilsService.isSelfHost();
} }
@ -150,7 +151,10 @@ export class CreateOrganizationComponent {
} }
async finalize(orgId: string) { async finalize(orgId: string) {
this.apiService.refreshIdentityToken(); await Promise.all([
this.apiService.refreshIdentityToken(),
this.syncService.fullSync(true),
]);
this.analytics.eventTrack.next({ action: 'Created Organization' }); this.analytics.eventTrack.next({ action: 'Created Organization' });
this.toasterService.popAsync('success', this.i18nService.t('organizationCreated'), this.toasterService.popAsync('success', this.i18nService.t('organizationCreated'),
this.i18nService.t('organizationReadyToGo')); this.i18nService.t('organizationReadyToGo'));

View File

@ -12,6 +12,7 @@ import { ApiService } from 'jslib/abstractions/api.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { MessagingService } from 'jslib/abstractions/messaging.service'; import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { SyncService } from 'jslib/abstractions/sync.service';
import { TokenService } from 'jslib/abstractions/token.service'; import { TokenService } from 'jslib/abstractions/token.service';
import { PaymentComponent } from './payment.component'; import { PaymentComponent } from './payment.component';
@ -33,7 +34,8 @@ export class PremiumComponent implements OnInit {
constructor(private apiService: ApiService, private i18nService: I18nService, constructor(private apiService: ApiService, private i18nService: I18nService,
private analytics: Angulartics2, private toasterService: ToasterService, private analytics: Angulartics2, private toasterService: ToasterService,
platformUtilsService: PlatformUtilsService, private tokenService: TokenService, platformUtilsService: PlatformUtilsService, private tokenService: TokenService,
private router: Router, private messagingService: MessagingService) { private router: Router, private messagingService: MessagingService,
private syncService: SyncService) {
this.selfHosted = platformUtilsService.isSelfHost(); this.selfHosted = platformUtilsService.isSelfHost();
} }
@ -79,7 +81,10 @@ export class PremiumComponent implements OnInit {
} }
async finalizePremium() { async finalizePremium() {
await this.apiService.refreshIdentityToken(); await Promise.all([
this.apiService.refreshIdentityToken(),
this.syncService.fullSync(true),
]);
this.analytics.eventTrack.next({ action: 'Signed Up Premium' }); this.analytics.eventTrack.next({ action: 'Signed Up Premium' });
this.toasterService.popAsync('success', null, this.i18nService.t('premiumUpdated')); this.toasterService.popAsync('success', null, this.i18nService.t('premiumUpdated'));
this.messagingService.send('purchasedPremium'); this.messagingService.send('purchasedPremium');

View File

@ -2,7 +2,7 @@
<table class="table table-hover table-list table-ciphers" *ngIf="searchedCiphers.length > 0"> <table class="table table-hover table-list table-ciphers" *ngIf="searchedCiphers.length > 0">
<tbody> <tbody>
<tr *ngFor="let c of searchedCiphers"> <tr *ngFor="let c of searchedCiphers">
<td (click)="checkCipher(c)" class="table-list-checkbox"> <td (click)="checkCipher(c)" class="table-list-checkbox" *ngIf="!organization">
<input type="checkbox" [(ngModel)]="c.checked"> <input type="checkbox" [(ngModel)]="c.checked">
</td> </td>
<td (click)="checkCipher(c)" class="table-list-icon"> <td (click)="checkCipher(c)" class="table-list-icon">
@ -30,7 +30,7 @@
<i class="fa fa-fw fa-paperclip"></i> <i class="fa fa-fw fa-paperclip"></i>
{{'attachments' | i18n}} {{'attachments' | i18n}}
</a> </a>
<a class="dropdown-item" href="#" appStopClick *ngIf="!c.organizationId" (click)="share(c)"> <a class="dropdown-item" href="#" appStopClick *ngIf="!organization && !c.organizationId" (click)="share(c)">
<i class="fa fa-fw fa-share-alt"></i> <i class="fa fa-fw fa-share-alt"></i>
{{'share' | i18n}} {{'share' | i18n}}
</a> </a>