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 { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { SyncService } from 'jslib/abstractions/sync.service';
import { PaymentComponent } from './payment.component';
@ -82,7 +83,7 @@ export class CreateOrganizationComponent {
constructor(private apiService: ApiService, private i18nService: I18nService,
private analytics: Angulartics2, private toasterService: ToasterService,
platformUtilsService: PlatformUtilsService, private cryptoService: CryptoService,
private router: Router) {
private router: Router, private syncService: SyncService) {
this.selfHosted = platformUtilsService.isSelfHost();
}
@ -150,7 +151,10 @@ export class CreateOrganizationComponent {
}
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.toasterService.popAsync('success', this.i18nService.t('organizationCreated'),
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 { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { SyncService } from 'jslib/abstractions/sync.service';
import { TokenService } from 'jslib/abstractions/token.service';
import { PaymentComponent } from './payment.component';
@ -33,7 +34,8 @@ export class PremiumComponent implements OnInit {
constructor(private apiService: ApiService, private i18nService: I18nService,
private analytics: Angulartics2, private toasterService: ToasterService,
platformUtilsService: PlatformUtilsService, private tokenService: TokenService,
private router: Router, private messagingService: MessagingService) {
private router: Router, private messagingService: MessagingService,
private syncService: SyncService) {
this.selfHosted = platformUtilsService.isSelfHost();
}
@ -79,7 +81,10 @@ export class PremiumComponent implements OnInit {
}
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.toasterService.popAsync('success', null, this.i18nService.t('premiumUpdated'));
this.messagingService.send('purchasedPremium');

View File

@ -2,7 +2,7 @@
<table class="table table-hover table-list table-ciphers" *ngIf="searchedCiphers.length > 0">
<tbody>
<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">
</td>
<td (click)="checkCipher(c)" class="table-list-icon">
@ -30,7 +30,7 @@
<i class="fa fa-fw fa-paperclip"></i>
{{'attachments' | i18n}}
</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>
{{'share' | i18n}}
</a>