1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 13:23:34 +00:00

PM-5274 Migrate Collection Service State (#7732)

* update collection service to use new state provider framework, remove stateservice from collection service, update collections state provider with migrate file and unit test
This commit is contained in:
Jason Ng
2024-02-14 17:03:03 -05:00
committed by GitHub
parent d8b74b78da
commit 3edf098aaf
23 changed files with 426 additions and 170 deletions

View File

@@ -19,7 +19,6 @@ import { MigrationRunner } from "@bitwarden/common/platform/services/migration-r
import { StateService as BaseStateService } from "@bitwarden/common/platform/services/state.service";
import { SendData } from "@bitwarden/common/tools/send/models/data/send.data";
import { CipherData } from "@bitwarden/common/vault/models/data/cipher.data";
import { CollectionData } from "@bitwarden/common/vault/models/data/collection.data";
import { Account } from "./account";
import { GlobalState } from "./global-state";
@@ -69,21 +68,6 @@ export class StateService extends BaseStateService<GlobalState, Account> {
return await super.setEncryptedCiphers(value, options);
}
async getEncryptedCollections(
options?: StorageOptions,
): Promise<{ [id: string]: CollectionData }> {
options = this.reconcileOptions(options, await this.defaultInMemoryOptions());
return await super.getEncryptedCollections(options);
}
async setEncryptedCollections(
value: { [id: string]: CollectionData },
options?: StorageOptions,
): Promise<void> {
options = this.reconcileOptions(options, await this.defaultInMemoryOptions());
return await super.setEncryptedCollections(value, options);
}
async getEncryptedSends(options?: StorageOptions): Promise<{ [id: string]: SendData }> {
options = this.reconcileOptions(options, await this.defaultInMemoryOptions());
return await super.getEncryptedSends(options);

View File

@@ -28,7 +28,7 @@
aria-hidden="true"
></i>
<span>{{ title }}</span>
<ng-container *ngIf="collection !== undefined && (canEditCollection || canDeleteCollection)">
<ng-container *ngIf="collection != null && (canEditCollection || canDeleteCollection)">
<button
bitIconButton="bwi-angle-down"
[bitMenuTriggerFor]="editCollectionMenu"

View File

@@ -125,7 +125,7 @@ export class VaultHeaderComponent {
get canEditCollection(): boolean {
// Only edit collections if not editing "Unassigned"
if (this.collection === undefined) {
if (this.collection == null) {
return false;
}

View File

@@ -33,7 +33,7 @@
aria-hidden="true"
></i>
<span>{{ title }}</span>
<ng-container *ngIf="collection !== undefined && (canEditCollection || canDeleteCollection)">
<ng-container *ngIf="collection != null && (canEditCollection || canDeleteCollection)">
<button
bitIconButton="bwi-angle-down"
[bitMenuTriggerFor]="editCollectionMenu"