Merge remote-tracking branch 'origin/develop' into develop
commit
685e5b916b
|
@ -108,14 +108,20 @@ export default withMatrixClient(React.createClass({
|
||||||
if (!uniqueMembers[m.userId]) uniqueMembers[m.userId] = m;
|
if (!uniqueMembers[m.userId]) uniqueMembers[m.userId] = m;
|
||||||
});
|
});
|
||||||
memberList = Object.keys(uniqueMembers).map((userId) => uniqueMembers[userId]);
|
memberList = Object.keys(uniqueMembers).map((userId) => uniqueMembers[userId]);
|
||||||
|
// Descending sort on isPrivileged = true = 1 to isPrivileged = false = 0
|
||||||
memberList.sort((a, b) => {
|
memberList.sort((a, b) => {
|
||||||
// TODO: should put admins at the top: we don't yet have that info
|
if (a.isPrivileged === b.isPrivileged) {
|
||||||
if (a < b) {
|
const aName = a.displayname || a.userId;
|
||||||
return -1;
|
const bName = b.displayname || b.userId;
|
||||||
} else if (a > b) {
|
if (aName < bName) {
|
||||||
return 1;
|
return -1;
|
||||||
|
} else if (aName > bName) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return a.isPrivileged ? -1 : 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue