From 51ead2e7da7b24122dff2f0f90cae4c13133096e Mon Sep 17 00:00:00 2001 From: aj-rosado <109146700+aj-rosado@users.noreply.github.com> Date: Wed, 11 Jan 2023 22:47:26 +0000 Subject: [PATCH] [PS-2120] Forcing vault to refresh when the vault is purged or new items are imported (#4380) * [PS-2120] Forcing vault to refresh when the vault is purged or new items are imported * [PS-2120] Forcing vault refresh by calling fullSync with force as true --- .../tools/import-export/org-import.component.ts | 7 +++++-- apps/web/src/app/settings/purge-vault.component.ts | 5 ++++- apps/web/src/app/tools/import-export/import.component.ts | 5 ++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/web/src/app/organizations/tools/import-export/org-import.component.ts b/apps/web/src/app/organizations/tools/import-export/org-import.component.ts index 81a16a2968..2e70908cd8 100644 --- a/apps/web/src/app/organizations/tools/import-export/org-import.component.ts +++ b/apps/web/src/app/organizations/tools/import-export/org-import.component.ts @@ -8,6 +8,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service"; import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction"; import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction"; +import { SyncService } from "@bitwarden/common/abstractions/sync/sync.service.abstraction"; import { ImportComponent } from "../../../tools/import-export/import.component"; @@ -28,7 +29,8 @@ export class OrganizationImportComponent extends ImportComponent { policyService: PolicyService, private organizationService: OrganizationService, logService: LogService, - modalService: ModalService + modalService: ModalService, + syncService: SyncService ) { super( i18nService, @@ -37,7 +39,8 @@ export class OrganizationImportComponent extends ImportComponent { platformUtilsService, policyService, logService, - modalService + modalService, + syncService ); } diff --git a/apps/web/src/app/settings/purge-vault.component.ts b/apps/web/src/app/settings/purge-vault.component.ts index e10782914f..52cb89e4c6 100644 --- a/apps/web/src/app/settings/purge-vault.component.ts +++ b/apps/web/src/app/settings/purge-vault.component.ts @@ -5,6 +5,7 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { I18nService } from "@bitwarden/common/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; +import { SyncService } from "@bitwarden/common/abstractions/sync/sync.service.abstraction"; import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction"; import { Verification } from "@bitwarden/common/types/verification"; @@ -24,7 +25,8 @@ export class PurgeVaultComponent { private platformUtilsService: PlatformUtilsService, private userVerificationService: UserVerificationService, private router: Router, - private logService: LogService + private logService: LogService, + private syncService: SyncService ) {} async submit() { @@ -34,6 +36,7 @@ export class PurgeVaultComponent { .then((request) => this.apiService.postPurgeCiphers(request, this.organizationId)); await this.formPromise; this.platformUtilsService.showToast("success", null, this.i18nService.t("vaultPurged")); + this.syncService.fullSync(true); if (this.organizationId != null) { this.router.navigate(["organizations", this.organizationId, "vault"]); } else { diff --git a/apps/web/src/app/tools/import-export/import.component.ts b/apps/web/src/app/tools/import-export/import.component.ts index 3abaebe2bc..da9a27542c 100644 --- a/apps/web/src/app/tools/import-export/import.component.ts +++ b/apps/web/src/app/tools/import-export/import.component.ts @@ -10,6 +10,7 @@ import { ImportService } from "@bitwarden/common/abstractions/import.service"; import { LogService } from "@bitwarden/common/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction"; +import { SyncService } from "@bitwarden/common/abstractions/sync/sync.service.abstraction"; import { ImportOption, ImportType } from "@bitwarden/common/enums/importOptions"; import { PolicyType } from "@bitwarden/common/enums/policyType"; import { ImportError } from "@bitwarden/common/importers/import-error"; @@ -40,7 +41,8 @@ export class ImportComponent implements OnInit { protected platformUtilsService: PlatformUtilsService, protected policyService: PolicyService, private logService: LogService, - protected modalService: ModalService + protected modalService: ModalService, + protected syncService: SyncService ) {} async ngOnInit() { @@ -133,6 +135,7 @@ export class ImportComponent implements OnInit { //No errors, display success message this.platformUtilsService.showToast("success", null, this.i18nService.t("importSuccess")); + this.syncService.fullSync(true); this.router.navigate(this.successNavigate); } catch (e) { this.logService.error(e);