1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

Sort organization filters alphabetically (#5117)

This commit is contained in:
Robyn MacCallum
2023-04-06 10:31:36 -04:00
committed by GitHub
parent 019aaf214b
commit 19626a7837

View File

@@ -138,12 +138,16 @@ export class VaultFilterService implements VaultFilterServiceAbstraction {
orgs = orgs.slice(0, 1);
}
if (orgs) {
const orgNodes: TreeNode<OrganizationFilter>[] = [];
orgs.filter(isNotProviderUser).forEach((org) => {
const orgCopy = org as OrganizationFilter;
orgCopy.icon = "bwi-business";
const node = new TreeNode<OrganizationFilter>(orgCopy, headNode, orgCopy.name);
headNode.children.push(node);
orgNodes.push(node);
});
// Sort organization nodes, then add them to the list after 'My Vault' and 'All Vaults' if present
orgNodes.sort((a, b) => a.node.name.localeCompare(b.node.name));
headNode.children.push(...orgNodes);
}
return headNode;
}