mirror of
https://github.com/cockpit-project/cockpit.git
synced 2026-11-03 21:49:50 -09:00
users: Fix locale sort for groups
Within account details there is a select dropdown to select groups for a user. This was meant to be sorted by `isAdmin` field, followed by alphabetical order. In reality the alphabetical sorting wasn't done correctly and we got strange sorting. On top of that, the `isAdmin` sort method didn't take into consideration sorting the groups with `isAdmin` set to true. Fixes: https://github.com/cockpit-project/cockpit/issues/22909 Signed-off-by: Freya Gustavsson <freya@venefilyn.se>
This commit is contained in:
parent
acde760e23
commit
855eab6059
2 changed files with 4 additions and 7 deletions
|
|
@ -29,14 +29,11 @@ superuser.reload_page_on_change();
|
|||
export const admins = ['sudo', 'root', 'wheel'];
|
||||
const sortGroups = groups => {
|
||||
return groups.sort((a, b) => {
|
||||
if (a.isAdmin)
|
||||
if (a.isAdmin && !b.isAdmin)
|
||||
return -1;
|
||||
if (b.isAdmin)
|
||||
if (!a.isAdmin && b.isAdmin)
|
||||
return 1;
|
||||
if (a.members === b.members)
|
||||
return a.name.localeCompare(b.name);
|
||||
else
|
||||
return b.members - a.members;
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit d60e1985af04ad4b80792133817f7375026bc596
|
||||
Subproject commit e601537a2dfc8eaa377aeb7510e104160de04d40
|
||||
Loading…
Reference in a new issue