1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-07 12:13:45 +00:00

fix "No Folder" filter

This commit is contained in:
jaasen-livefront
2026-01-21 15:17:44 -08:00
parent cd290e441f
commit dfb653f2a7
7 changed files with 39 additions and 7 deletions

View File

@@ -143,6 +143,17 @@ describe("VaultFilter", () => {
expect(result).toBe(true);
});
it("should return true when filtering on unassigned folder via empty string id", () => {
const filterFunction = createFilterFunction({
selectedFolder: true,
selectedFolderId: "",
});
const result = filterFunction(cipher);
expect(result).toBe(true);
});
});
describe("given an organizational cipher (with organization and collections)", () => {

View File

@@ -57,10 +57,19 @@ export class VaultFilter {
if (this.cipherType != null && cipherPassesFilter) {
cipherPassesFilter = CipherViewLikeUtils.getType(cipher) === this.cipherType;
}
if (this.selectedFolder && this.selectedFolderId == null && cipherPassesFilter) {
cipherPassesFilter = cipher.folderId == null;
if (
this.selectedFolder &&
(this.selectedFolderId == null || this.selectedFolderId === "") &&
cipherPassesFilter
) {
cipherPassesFilter = cipher.folderId == null || cipher.folderId === "";
}
if (this.selectedFolder && this.selectedFolderId != null && cipherPassesFilter) {
if (
this.selectedFolder &&
this.selectedFolderId != null &&
this.selectedFolderId !== "" &&
cipherPassesFilter
) {
cipherPassesFilter = cipher.folderId === this.selectedFolderId;
}
if (this.selectedCollection && this.selectedCollectionId == null && cipherPassesFilter) {