mirror of
https://github.com/element-hq/element-web
synced 2024-11-25 02:35:48 +03:00
If group member privilege level is equal, disambiguate with displayname or userId
This commit is contained in:
parent
e3e161fbea
commit
e2a0cba6cb
1 changed files with 13 additions and 1 deletions
|
@ -110,7 +110,19 @@ export default withMatrixClient(React.createClass({
|
|||
memberList = Object.keys(uniqueMembers).map((userId) => uniqueMembers[userId]);
|
||||
// Descending sort on isPrivileged = true = 1 to isPrivileged = false = 0
|
||||
memberList.sort((a, b) => {
|
||||
return b.isPrivileged - a.isPrivileged;
|
||||
if (a.isPrivileged === b.isPrivileged) {
|
||||
const aName = a.displayname || a.userId;
|
||||
const bName = b.displayname || b.userId;
|
||||
if (aName < bName) {
|
||||
return -1;
|
||||
} else if (aName > bName) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return a.isPrivileged ? -1 : 1;
|
||||
}
|
||||
});
|
||||
|
||||
const memberTiles = memberList.map((m) => {
|
||||
|
|
Loading…
Reference in a new issue