1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

[PM-12049] Remove usage of ActiveUserState from folder service (#11880)

* Migrated folder service from using active user state to single user state

Added extra test cases for encrypted folder and decrypted folders

Updated derived state to use decrypt with key

* Update callers in the web

* Update callers in the browser

* Update callers in libs

* Update callers in cli

* Fixed test

* Fixed folder state test

* Fixed test

* removed duplicate activeUserId

* Added takewhile operator to only make calls when userId is present

* Simplified to accept a single user id instead of an observable

* Required userid to be passed from notification service

* [PM-15635] Folders not working on desktop (#12333)

* Added folders memory state definition

* added decrypted folders state

* Refactored service to remove derived state

* removed combinedstate and added clear decrypted folders to methods

* Fixed test

* Fixed issue with editing folder on the desktop app

* Fixed test

* Changed state name

* fixed ts strict issue

* fixed ts strict issue

* fixed ts strict issue

* removed unnecessasry null encrypteed folder check

* Handle null folderdata

* [PM-16197] "Items with No Folder" shows as a folder to edit name and delete (#12470)

* Force redcryption anytime encryption state changes

* Fixed text file

* revert changes

* create new object with nofolder instead of modifying exisiting object

* Fixed failing test

* switched to use memory-large-object

* Fixed ts sctrict issue

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com>
This commit is contained in:
SmithThe4th
2025-01-02 17:16:33 -05:00
committed by GitHub
parent b9660194be
commit 10c8a2101a
49 changed files with 600 additions and 395 deletions

View File

@@ -1,3 +1,5 @@
import { UserId } from "@bitwarden/common/types/guid";
import { ApiService } from "../../../abstractions/api.service";
import { FolderApiServiceAbstraction } from "../../../vault/abstractions/folder/folder-api.service.abstraction";
import { InternalFolderService } from "../../../vault/abstractions/folder/folder.service.abstraction";
@@ -12,7 +14,7 @@ export class FolderApiService implements FolderApiServiceAbstraction {
private apiService: ApiService,
) {}
async save(folder: Folder): Promise<any> {
async save(folder: Folder, userId: UserId): Promise<any> {
const request = new FolderRequest(folder);
let response: FolderResponse;
@@ -24,17 +26,17 @@ export class FolderApiService implements FolderApiServiceAbstraction {
}
const data = new FolderData(response);
await this.folderService.upsert(data);
await this.folderService.upsert(data, userId);
}
async delete(id: string): Promise<any> {
async delete(id: string, userId: UserId): Promise<any> {
await this.deleteFolder(id);
await this.folderService.delete(id);
await this.folderService.delete(id, userId);
}
async deleteAll(): Promise<void> {
async deleteAll(userId: UserId): Promise<void> {
await this.apiService.send("DELETE", "/folders/all", null, true, false);
await this.folderService.clear();
await this.folderService.clear(userId);
}
async get(id: string): Promise<FolderResponse> {