diff --git a/apps/web/src/app/admin-console/organizations/tools/exposed-passwords-report.component.ts b/apps/web/src/app/admin-console/organizations/tools/exposed-passwords-report.component.ts index d354459ee9f..cab6189c456 100644 --- a/apps/web/src/app/admin-console/organizations/tools/exposed-passwords-report.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/exposed-passwords-report.component.ts @@ -6,6 +6,7 @@ import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { PasswordRepromptService } from "@bitwarden/vault"; @@ -29,6 +30,7 @@ export class ExposedPasswordsReportComponent extends BaseExposedPasswordsReportC private route: ActivatedRoute, passwordRepromptService: PasswordRepromptService, i18nService: I18nService, + syncService: SyncService, ) { super( cipherService, @@ -37,6 +39,7 @@ export class ExposedPasswordsReportComponent extends BaseExposedPasswordsReportC modalService, passwordRepromptService, i18nService, + syncService, ); } diff --git a/apps/web/src/app/admin-console/organizations/tools/inactive-two-factor-report.component.ts b/apps/web/src/app/admin-console/organizations/tools/inactive-two-factor-report.component.ts index 67d4e963b0b..abfbd45f38a 100644 --- a/apps/web/src/app/admin-console/organizations/tools/inactive-two-factor-report.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/inactive-two-factor-report.component.ts @@ -6,6 +6,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { PasswordRepromptService } from "@bitwarden/vault"; @@ -26,6 +27,7 @@ export class InactiveTwoFactorReportComponent extends BaseInactiveTwoFactorRepor passwordRepromptService: PasswordRepromptService, organizationService: OrganizationService, i18nService: I18nService, + syncService: SyncService, ) { super( cipherService, @@ -34,6 +36,7 @@ export class InactiveTwoFactorReportComponent extends BaseInactiveTwoFactorRepor logService, passwordRepromptService, i18nService, + syncService, ); } diff --git a/apps/web/src/app/admin-console/organizations/tools/reused-passwords-report.component.ts b/apps/web/src/app/admin-console/organizations/tools/reused-passwords-report.component.ts index c8ceb023af2..76d783b6664 100644 --- a/apps/web/src/app/admin-console/organizations/tools/reused-passwords-report.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/reused-passwords-report.component.ts @@ -5,6 +5,7 @@ import { ModalService } from "@bitwarden/angular/services/modal.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { PasswordRepromptService } from "@bitwarden/vault"; @@ -27,8 +28,16 @@ export class ReusedPasswordsReportComponent extends BaseReusedPasswordsReportCom organizationService: OrganizationService, passwordRepromptService: PasswordRepromptService, i18nService: I18nService, + syncService: SyncService, ) { - super(cipherService, organizationService, modalService, passwordRepromptService, i18nService); + super( + cipherService, + organizationService, + modalService, + passwordRepromptService, + i18nService, + syncService, + ); } async ngOnInit() { diff --git a/apps/web/src/app/admin-console/organizations/tools/unsecured-websites-report.component.ts b/apps/web/src/app/admin-console/organizations/tools/unsecured-websites-report.component.ts index 2a905b36651..7f6f08fb96f 100644 --- a/apps/web/src/app/admin-console/organizations/tools/unsecured-websites-report.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/unsecured-websites-report.component.ts @@ -5,6 +5,7 @@ import { ModalService } from "@bitwarden/angular/services/modal.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { PasswordRepromptService } from "@bitwarden/vault"; @@ -24,8 +25,16 @@ export class UnsecuredWebsitesReportComponent extends BaseUnsecuredWebsitesRepor organizationService: OrganizationService, passwordRepromptService: PasswordRepromptService, i18nService: I18nService, + syncService: SyncService, ) { - super(cipherService, organizationService, modalService, passwordRepromptService, i18nService); + super( + cipherService, + organizationService, + modalService, + passwordRepromptService, + i18nService, + syncService, + ); } async ngOnInit() { diff --git a/apps/web/src/app/admin-console/organizations/tools/weak-passwords-report.component.ts b/apps/web/src/app/admin-console/organizations/tools/weak-passwords-report.component.ts index 8820e596e3f..0ac21294782 100644 --- a/apps/web/src/app/admin-console/organizations/tools/weak-passwords-report.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/weak-passwords-report.component.ts @@ -6,6 +6,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { PasswordRepromptService } from "@bitwarden/vault"; @@ -29,6 +30,7 @@ export class WeakPasswordsReportComponent extends BaseWeakPasswordsReportCompone organizationService: OrganizationService, passwordRepromptService: PasswordRepromptService, i18nService: I18nService, + syncService: SyncService, ) { super( cipherService, @@ -37,6 +39,7 @@ export class WeakPasswordsReportComponent extends BaseWeakPasswordsReportCompone modalService, passwordRepromptService, i18nService, + syncService, ); } diff --git a/apps/web/src/app/tools/reports/pages/cipher-report.component.ts b/apps/web/src/app/tools/reports/pages/cipher-report.component.ts index 041307122b2..4e63dd5cc96 100644 --- a/apps/web/src/app/tools/reports/pages/cipher-report.component.ts +++ b/apps/web/src/app/tools/reports/pages/cipher-report.component.ts @@ -6,6 +6,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { PasswordRepromptService } from "@bitwarden/vault"; @@ -40,6 +41,7 @@ export class CipherReportComponent implements OnDestroy { protected passwordRepromptService: PasswordRepromptService, protected organizationService: OrganizationService, protected i18nService: I18nService, + private syncService: SyncService, ) { this.organizations$ = this.organizationService.organizations$; this.organizations$.pipe(takeUntil(this.destroyed$)).subscribe((orgs) => { @@ -106,6 +108,7 @@ export class CipherReportComponent implements OnDestroy { async load() { this.loading = true; + await this.syncService.fullSync(false); // when a user fixes an item in a report we want to persist the filter they had // if they fix the last item of that filter we will go back to the "All" filter if (this.currentFilterStatus) { diff --git a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.spec.ts b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.spec.ts index 7b73ad83053..07dc218bd64 100644 --- a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.spec.ts +++ b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.spec.ts @@ -9,6 +9,7 @@ import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { PasswordRepromptService } from "@bitwarden/vault"; import { ExposedPasswordsReportComponent } from "./exposed-passwords-report.component"; @@ -19,8 +20,10 @@ describe("ExposedPasswordsReportComponent", () => { let fixture: ComponentFixture; let auditService: MockProxy; let organizationService: MockProxy; + let syncServiceMock: MockProxy; beforeEach(() => { + syncServiceMock = mock(); auditService = mock(); organizationService = mock(); organizationService.organizations$ = of([]); @@ -49,6 +52,10 @@ describe("ExposedPasswordsReportComponent", () => { provide: PasswordRepromptService, useValue: mock(), }, + { + provide: SyncService, + useValue: syncServiceMock, + }, { provide: I18nService, useValue: mock(), @@ -82,4 +89,8 @@ describe("ExposedPasswordsReportComponent", () => { expect(component.ciphers[1].id).toEqual(expectedIdTwo); expect(component.ciphers[1].edit).toEqual(true); }); + + it("should call fullSync method of syncService", () => { + expect(syncServiceMock.fullSync).toHaveBeenCalledWith(false); + }); }); diff --git a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts index 39414487d7b..cabc7bdfa12 100644 --- a/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts +++ b/apps/web/src/app/tools/reports/pages/exposed-passwords-report.component.ts @@ -5,6 +5,7 @@ import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherType } from "@bitwarden/common/vault/enums"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { PasswordRepromptService } from "@bitwarden/vault"; @@ -26,8 +27,16 @@ export class ExposedPasswordsReportComponent extends CipherReportComponent imple modalService: ModalService, passwordRepromptService: PasswordRepromptService, i18nService: I18nService, + syncService: SyncService, ) { - super(cipherService, modalService, passwordRepromptService, organizationService, i18nService); + super( + cipherService, + modalService, + passwordRepromptService, + organizationService, + i18nService, + syncService, + ); } async ngOnInit() { diff --git a/apps/web/src/app/tools/reports/pages/inactive-two-factor-report.component.spec.ts b/apps/web/src/app/tools/reports/pages/inactive-two-factor-report.component.spec.ts index 528f6306e0c..80760eb5dec 100644 --- a/apps/web/src/app/tools/reports/pages/inactive-two-factor-report.component.spec.ts +++ b/apps/web/src/app/tools/reports/pages/inactive-two-factor-report.component.spec.ts @@ -9,6 +9,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { PasswordRepromptService } from "@bitwarden/vault"; import { InactiveTwoFactorReportComponent } from "./inactive-two-factor-report.component"; @@ -18,10 +19,12 @@ describe("InactiveTwoFactorReportComponent", () => { let component: InactiveTwoFactorReportComponent; let fixture: ComponentFixture; let organizationService: MockProxy; + let syncServiceMock: MockProxy; beforeEach(() => { organizationService = mock(); organizationService.organizations$ = of([]); + syncServiceMock = mock(); // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. // eslint-disable-next-line @typescript-eslint/no-floating-promises TestBed.configureTestingModule({ @@ -47,6 +50,10 @@ describe("InactiveTwoFactorReportComponent", () => { provide: PasswordRepromptService, useValue: mock(), }, + { + provide: SyncService, + useValue: syncServiceMock, + }, { provide: I18nService, useValue: mock(), @@ -87,4 +94,8 @@ describe("InactiveTwoFactorReportComponent", () => { expect(component.ciphers[1].id).toEqual(expectedIdTwo); expect(component.ciphers[1].edit).toEqual(true); }); + + it("should call fullSync method of syncService", () => { + expect(syncServiceMock.fullSync).toHaveBeenCalledWith(false); + }); }); diff --git a/apps/web/src/app/tools/reports/pages/inactive-two-factor-report.component.ts b/apps/web/src/app/tools/reports/pages/inactive-two-factor-report.component.ts index 956607c8fb2..5cfe2cd1a9e 100644 --- a/apps/web/src/app/tools/reports/pages/inactive-two-factor-report.component.ts +++ b/apps/web/src/app/tools/reports/pages/inactive-two-factor-report.component.ts @@ -6,6 +6,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherType } from "@bitwarden/common/vault/enums"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { PasswordRepromptService } from "@bitwarden/vault"; @@ -28,8 +29,16 @@ export class InactiveTwoFactorReportComponent extends CipherReportComponent impl private logService: LogService, passwordRepromptService: PasswordRepromptService, i18nService: I18nService, + syncService: SyncService, ) { - super(cipherService, modalService, passwordRepromptService, organizationService, i18nService); + super( + cipherService, + modalService, + passwordRepromptService, + organizationService, + i18nService, + syncService, + ); } async ngOnInit() { diff --git a/apps/web/src/app/tools/reports/pages/reused-passwords-report.component.spec.ts b/apps/web/src/app/tools/reports/pages/reused-passwords-report.component.spec.ts index 29e20c11af1..9d16bbb1c62 100644 --- a/apps/web/src/app/tools/reports/pages/reused-passwords-report.component.spec.ts +++ b/apps/web/src/app/tools/reports/pages/reused-passwords-report.component.spec.ts @@ -8,6 +8,7 @@ import { ModalService } from "@bitwarden/angular/services/modal.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { PasswordRepromptService } from "@bitwarden/vault"; import { cipherData } from "./reports-ciphers.mock"; @@ -17,10 +18,12 @@ describe("ReusedPasswordsReportComponent", () => { let component: ReusedPasswordsReportComponent; let fixture: ComponentFixture; let organizationService: MockProxy; + let syncServiceMock: MockProxy; beforeEach(() => { organizationService = mock(); organizationService.organizations$ = of([]); + syncServiceMock = mock(); // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. // eslint-disable-next-line @typescript-eslint/no-floating-promises TestBed.configureTestingModule({ @@ -42,6 +45,10 @@ describe("ReusedPasswordsReportComponent", () => { provide: PasswordRepromptService, useValue: mock(), }, + { + provide: SyncService, + useValue: syncServiceMock, + }, { provide: I18nService, useValue: mock(), @@ -73,4 +80,8 @@ describe("ReusedPasswordsReportComponent", () => { expect(component.ciphers[1].id).toEqual(expectedIdTwo); expect(component.ciphers[1].edit).toEqual(true); }); + + it("should call fullSync method of syncService", () => { + expect(syncServiceMock.fullSync).toHaveBeenCalledWith(false); + }); }); diff --git a/apps/web/src/app/tools/reports/pages/reused-passwords-report.component.ts b/apps/web/src/app/tools/reports/pages/reused-passwords-report.component.ts index cbc2ea11b5b..70cb2ed69b3 100644 --- a/apps/web/src/app/tools/reports/pages/reused-passwords-report.component.ts +++ b/apps/web/src/app/tools/reports/pages/reused-passwords-report.component.ts @@ -4,6 +4,7 @@ import { ModalService } from "@bitwarden/angular/services/modal.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherType } from "@bitwarden/common/vault/enums"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { PasswordRepromptService } from "@bitwarden/vault"; @@ -24,8 +25,16 @@ export class ReusedPasswordsReportComponent extends CipherReportComponent implem modalService: ModalService, passwordRepromptService: PasswordRepromptService, i18nService: I18nService, + syncService: SyncService, ) { - super(cipherService, modalService, passwordRepromptService, organizationService, i18nService); + super( + cipherService, + modalService, + passwordRepromptService, + organizationService, + i18nService, + syncService, + ); } async ngOnInit() { diff --git a/apps/web/src/app/tools/reports/pages/unsecured-websites-report.component.spec.ts b/apps/web/src/app/tools/reports/pages/unsecured-websites-report.component.spec.ts index 3b7c6d350f7..e616d1f21e5 100644 --- a/apps/web/src/app/tools/reports/pages/unsecured-websites-report.component.spec.ts +++ b/apps/web/src/app/tools/reports/pages/unsecured-websites-report.component.spec.ts @@ -8,6 +8,7 @@ import { ModalService } from "@bitwarden/angular/services/modal.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { PasswordRepromptService } from "@bitwarden/vault"; import { cipherData } from "./reports-ciphers.mock"; @@ -17,10 +18,12 @@ describe("UnsecuredWebsitesReportComponent", () => { let component: UnsecuredWebsitesReportComponent; let fixture: ComponentFixture; let organizationService: MockProxy; + let syncServiceMock: MockProxy; beforeEach(() => { organizationService = mock(); organizationService.organizations$ = of([]); + syncServiceMock = mock(); // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. // eslint-disable-next-line @typescript-eslint/no-floating-promises TestBed.configureTestingModule({ @@ -42,6 +45,10 @@ describe("UnsecuredWebsitesReportComponent", () => { provide: PasswordRepromptService, useValue: mock(), }, + { + provide: SyncService, + useValue: syncServiceMock, + }, { provide: I18nService, useValue: mock(), @@ -73,4 +80,8 @@ describe("UnsecuredWebsitesReportComponent", () => { expect(component.ciphers[1].id).toEqual(expectedIdTwo); expect(component.ciphers[1].edit).toEqual(true); }); + + it("should call fullSync method of syncService", () => { + expect(syncServiceMock.fullSync).toHaveBeenCalledWith(false); + }); }); diff --git a/apps/web/src/app/tools/reports/pages/unsecured-websites-report.component.ts b/apps/web/src/app/tools/reports/pages/unsecured-websites-report.component.ts index 769eb058cd6..0a8023c3031 100644 --- a/apps/web/src/app/tools/reports/pages/unsecured-websites-report.component.ts +++ b/apps/web/src/app/tools/reports/pages/unsecured-websites-report.component.ts @@ -4,6 +4,7 @@ import { ModalService } from "@bitwarden/angular/services/modal.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherType } from "@bitwarden/common/vault/enums"; import { PasswordRepromptService } from "@bitwarden/vault"; @@ -22,8 +23,16 @@ export class UnsecuredWebsitesReportComponent extends CipherReportComponent impl modalService: ModalService, passwordRepromptService: PasswordRepromptService, i18nService: I18nService, + syncService: SyncService, ) { - super(cipherService, modalService, passwordRepromptService, organizationService, i18nService); + super( + cipherService, + modalService, + passwordRepromptService, + organizationService, + i18nService, + syncService, + ); } async ngOnInit() { diff --git a/apps/web/src/app/tools/reports/pages/weak-passwords-report.component.spec.ts b/apps/web/src/app/tools/reports/pages/weak-passwords-report.component.spec.ts index dbc367b108b..bcace60ac0c 100644 --- a/apps/web/src/app/tools/reports/pages/weak-passwords-report.component.spec.ts +++ b/apps/web/src/app/tools/reports/pages/weak-passwords-report.component.spec.ts @@ -9,6 +9,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { PasswordRepromptService } from "@bitwarden/vault"; import { cipherData } from "./reports-ciphers.mock"; @@ -19,8 +20,10 @@ describe("WeakPasswordsReportComponent", () => { let fixture: ComponentFixture; let passwordStrengthService: MockProxy; let organizationService: MockProxy; + let syncServiceMock: MockProxy; beforeEach(() => { + syncServiceMock = mock(); passwordStrengthService = mock(); organizationService = mock(); organizationService.organizations$ = of([]); @@ -49,6 +52,10 @@ describe("WeakPasswordsReportComponent", () => { provide: PasswordRepromptService, useValue: mock(), }, + { + provide: SyncService, + useValue: syncServiceMock, + }, { provide: I18nService, useValue: mock(), @@ -85,4 +92,8 @@ describe("WeakPasswordsReportComponent", () => { expect(component.ciphers[1].id).toEqual(expectedIdTwo); expect(component.ciphers[1].edit).toEqual(true); }); + + it("should call fullSync method of syncService", () => { + expect(syncServiceMock.fullSync).toHaveBeenCalledWith(false); + }); }); diff --git a/apps/web/src/app/tools/reports/pages/weak-passwords-report.component.ts b/apps/web/src/app/tools/reports/pages/weak-passwords-report.component.ts index 4d179b58f3d..f33e0626abb 100644 --- a/apps/web/src/app/tools/reports/pages/weak-passwords-report.component.ts +++ b/apps/web/src/app/tools/reports/pages/weak-passwords-report.component.ts @@ -6,6 +6,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { Utils } from "@bitwarden/common/platform/misc/utils"; import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; +import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherType } from "@bitwarden/common/vault/enums"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { BadgeVariant } from "@bitwarden/components"; @@ -31,8 +32,16 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen modalService: ModalService, passwordRepromptService: PasswordRepromptService, i18nService: I18nService, + syncService: SyncService, ) { - super(cipherService, modalService, passwordRepromptService, organizationService, i18nService); + super( + cipherService, + modalService, + passwordRepromptService, + organizationService, + i18nService, + syncService, + ); } async ngOnInit() {