1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

[PM-329] Detangle SearchService & CipherService (#4838)

* Remove Circular Dependency

* Fix Vault Searching

* Remove Unused cipherServiceOptions

* Add searchService Parameter to CipherService

* Fix instantiation of CipherService in test
This commit is contained in:
Justin Baur
2023-04-07 11:11:20 -04:00
committed by GitHub
parent 36de1c8e32
commit 7263579eaf
20 changed files with 52 additions and 90 deletions

View File

@@ -53,7 +53,7 @@ export class CipherService implements CipherServiceAbstraction {
private settingsService: SettingsService,
private apiService: ApiService,
private i18nService: I18nService,
private searchService: () => SearchService,
private searchService: SearchService,
private stateService: StateService,
private encryptService: EncryptService,
private cipherFileUploadService: CipherFileUploadService
@@ -68,9 +68,9 @@ export class CipherService implements CipherServiceAbstraction {
await this.stateService.setDecryptedCiphers(value);
if (this.searchService != null) {
if (value == null) {
this.searchService().clearIndex();
this.searchService.clearIndex();
} else {
this.searchService().indexCiphers();
this.searchService.indexCiphers(value);
}
}
}
@@ -358,9 +358,9 @@ export class CipherService implements CipherServiceAbstraction {
private async reindexCiphers() {
const userId = await this.stateService.getUserId();
const reindexRequired =
this.searchService != null && (this.searchService().indexedEntityId ?? userId) !== userId;
this.searchService != null && (this.searchService.indexedEntityId ?? userId) !== userId;
if (reindexRequired) {
await this.searchService().indexCiphers(userId, await this.getDecryptedCipherCache());
this.searchService.indexCiphers(await this.getDecryptedCipherCache(), userId);
}
}