mirror of
https://github.com/element-hq/element-web
synced 2024-11-25 02:35:48 +03:00
tidy and switch to lexicographic sorting
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
06e1acdf04
commit
a88cbef331
1 changed files with 8 additions and 2 deletions
|
@ -719,8 +719,14 @@ module.exports = React.createClass({
|
|||
}
|
||||
});
|
||||
|
||||
privilegedUsers.sort((a, b) => userLevels[b.key] - userLevels[a.key]);
|
||||
mutedUsers.sort((a, b) => userLevels[a.key] - userLevels[b.key]);
|
||||
// comparator for sorting PL users lexicographically on PL descending, MXID ascending. (case-insensitive)
|
||||
const comparator = (a, b) => {
|
||||
const plDiff = userLevels[b.key] - userLevels[a.key];
|
||||
return plDiff !== 0 ? plDiff : a.key.toLocaleLowerCase().localeCompare(b.key.toLocaleLowerCase());
|
||||
};
|
||||
|
||||
privilegedUsers.sort(comparator);
|
||||
mutedUsers.sort(comparator);
|
||||
|
||||
if (privilegedUsers.length) {
|
||||
privilegedUsersSection =
|
||||
|
|
Loading…
Reference in a new issue