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]);
|
// comparator for sorting PL users lexicographically on PL descending, MXID ascending. (case-insensitive)
|
||||||
mutedUsers.sort((a, b) => userLevels[a.key] - userLevels[b.key]);
|
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) {
|
if (privilegedUsers.length) {
|
||||||
privilegedUsersSection =
|
privilegedUsersSection =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue