1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-25 12:15:18 +01:00

[PM-7874] Fix lost state when adding a vault item on the current tab view (#9020)

This commit is contained in:
Cesar Gonzalez 2024-05-02 11:39:48 -05:00 committed by GitHub
parent f51042f813
commit 6b286e9d9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 1 additions and 36 deletions

View File

@ -1,22 +0,0 @@
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { StateProvider } from "@bitwarden/common/platform/state";
import { SearchService } from "@bitwarden/common/services/search.service";
export class PopupSearchService extends SearchService {
constructor(logService: LogService, i18nService: I18nService, stateProvider: StateProvider) {
super(logService, i18nService, stateProvider);
}
clearIndex(): Promise<void> {
throw new Error("Not available.");
}
indexCiphers(): Promise<void> {
throw new Error("Not available.");
}
async getIndexForSearch() {
return await super.getIndexForSearch();
}
}

View File

@ -19,7 +19,6 @@ import { JslibServicesModule } from "@bitwarden/angular/services/jslib-services.
import { AuthRequestServiceAbstraction } from "@bitwarden/auth/common"; import { AuthRequestServiceAbstraction } from "@bitwarden/auth/common";
import { EventCollectionService as EventCollectionServiceAbstraction } from "@bitwarden/common/abstractions/event/event-collection.service"; import { EventCollectionService as EventCollectionServiceAbstraction } from "@bitwarden/common/abstractions/event/event-collection.service";
import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service"; import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service";
import { SearchService as SearchServiceAbstraction } from "@bitwarden/common/abstractions/search.service";
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout-settings.service"; import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout-settings.service";
import { VaultTimeoutService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout.service"; import { VaultTimeoutService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
@ -125,7 +124,6 @@ import { VaultFilterService } from "../../vault/services/vault-filter.service";
import { DebounceNavigationService } from "./debounce-navigation.service"; import { DebounceNavigationService } from "./debounce-navigation.service";
import { InitService } from "./init.service"; import { InitService } from "./init.service";
import { PopupCloseWarningService } from "./popup-close-warning.service"; import { PopupCloseWarningService } from "./popup-close-warning.service";
import { PopupSearchService } from "./popup-search.service";
const OBSERVABLE_LARGE_OBJECT_MEMORY_STORAGE = new SafeInjectionToken< const OBSERVABLE_LARGE_OBJECT_MEMORY_STORAGE = new SafeInjectionToken<
AbstractStorageService & ObservableStorageService AbstractStorageService & ObservableStorageService
@ -182,11 +180,6 @@ const safeProviders: SafeProvider[] = [
useFactory: getBgService<SsoLoginServiceAbstraction>("ssoLoginService"), useFactory: getBgService<SsoLoginServiceAbstraction>("ssoLoginService"),
deps: [], deps: [],
}), }),
safeProvider({
provide: SearchServiceAbstraction,
useClass: PopupSearchService,
deps: [LogService, I18nServiceAbstraction, StateProvider],
}),
safeProvider({ safeProvider({
provide: CryptoFunctionService, provide: CryptoFunctionService,
useFactory: () => new WebCryptoFunctionService(window), useFactory: () => new WebCryptoFunctionService(window),

View File

@ -292,8 +292,6 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
const ciphers = await this.cipherService.getAllDecryptedForUrl( const ciphers = await this.cipherService.getAllDecryptedForUrl(
this.url, this.url,
otherTypes.length > 0 ? otherTypes : null, otherTypes.length > 0 ? otherTypes : null,
null,
false,
); );
this.loginCiphers = []; this.loginCiphers = [];

View File

@ -33,7 +33,6 @@ export abstract class CipherService {
url: string, url: string,
includeOtherTypes?: CipherType[], includeOtherTypes?: CipherType[],
defaultMatch?: UriMatchStrategySetting, defaultMatch?: UriMatchStrategySetting,
reindexCiphers?: boolean,
) => Promise<CipherView[]>; ) => Promise<CipherView[]>;
getAllFromApiForOrganization: (organizationId: string) => Promise<CipherView[]>; getAllFromApiForOrganization: (organizationId: string) => Promise<CipherView[]>;
/** /**

View File

@ -441,7 +441,6 @@ export class CipherService implements CipherServiceAbstraction {
url: string, url: string,
includeOtherTypes?: CipherType[], includeOtherTypes?: CipherType[],
defaultMatch: UriMatchStrategySetting = null, defaultMatch: UriMatchStrategySetting = null,
reindexCiphers = true,
): Promise<CipherView[]> { ): Promise<CipherView[]> {
if (url == null && includeOtherTypes == null) { if (url == null && includeOtherTypes == null) {
return Promise.resolve([]); return Promise.resolve([]);
@ -450,9 +449,7 @@ export class CipherService implements CipherServiceAbstraction {
const equivalentDomains = await firstValueFrom( const equivalentDomains = await firstValueFrom(
this.domainSettingsService.getUrlEquivalentDomains(url), this.domainSettingsService.getUrlEquivalentDomains(url),
); );
const ciphers = reindexCiphers const ciphers = await this.getAllDecrypted();
? await this.getAllDecrypted()
: await this.getDecryptedCiphers();
defaultMatch ??= await firstValueFrom(this.domainSettingsService.defaultUriMatchStrategy$); defaultMatch ??= await firstValueFrom(this.domainSettingsService.defaultUriMatchStrategy$);
return ciphers.filter((cipher) => { return ciphers.filter((cipher) => {