1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-21 16:18:28 +01: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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,12 +138,16 @@ export class VaultFilterService implements VaultFilterServiceAbstraction {
orgs = orgs.slice(0, 1); orgs = orgs.slice(0, 1);
} }
if (orgs) { if (orgs) {
const orgNodes: TreeNode<OrganizationFilter>[] = [];
orgs.filter(isNotProviderUser).forEach((org) => { orgs.filter(isNotProviderUser).forEach((org) => {
const orgCopy = org as OrganizationFilter; const orgCopy = org as OrganizationFilter;
orgCopy.icon = "bwi-business"; orgCopy.icon = "bwi-business";
const node = new TreeNode<OrganizationFilter>(orgCopy, headNode, orgCopy.name); 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; return headNode;
} }