mirror of
https://github.com/bitwarden/browser
synced 2026-02-06 03:33:30 +00:00
fix id logic
This commit is contained in:
@@ -437,7 +437,7 @@ describe("VaultPopupListFiltersService", () => {
|
||||
|
||||
describe("folders$", () => {
|
||||
it('returns no folders when "No Folder" is the only option', (done) => {
|
||||
folderViews$.next([{ id: null, name: "No Folder" }]);
|
||||
folderViews$.next([{ id: "", name: "No Folder" }]);
|
||||
|
||||
service.folders$.subscribe((folders) => {
|
||||
expect(folders).toEqual([]);
|
||||
@@ -447,7 +447,7 @@ describe("VaultPopupListFiltersService", () => {
|
||||
|
||||
it('moves "No Folder" to the end of the list', (done) => {
|
||||
folderViews$.next([
|
||||
{ id: null, name: "No Folder" },
|
||||
{ id: "", name: "No Folder" },
|
||||
{ id: "2345", name: "Folder 2" },
|
||||
{ id: "1234", name: "Folder 1" },
|
||||
]);
|
||||
|
||||
@@ -390,7 +390,7 @@ export class VaultPopupListFiltersService {
|
||||
FolderView[],
|
||||
PopupCipherViewLike[],
|
||||
] => {
|
||||
if (folders.length === 1 && folders[0].id) {
|
||||
if (folders.length === 1 && !folders[0].id) {
|
||||
// Do not display folder selections when only the "no folder" option is available.
|
||||
return [filters as PopupListFilter, [], cipherViews];
|
||||
}
|
||||
@@ -409,7 +409,7 @@ export class VaultPopupListFiltersService {
|
||||
};
|
||||
|
||||
// Move the "no folder" option to the end of the list
|
||||
arrangedFolders = [...folders.filter((f) => !f.id), updatedNoFolder];
|
||||
arrangedFolders = [...folders.filter((f) => f.id), updatedNoFolder];
|
||||
}
|
||||
return [filters as PopupListFilter, arrangedFolders, cipherViews];
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user