forked from matrix/element-web
Order room members by lastActiveAgo
This commit is contained in:
parent
8dc73cb6cc
commit
959c0f0669
|
@ -115,6 +115,18 @@ module.exports = {
|
||||||
var cli = MatrixClientPeg.get();
|
var cli = MatrixClientPeg.get();
|
||||||
var all_members = cli.getRoom(this.props.roomId).currentState.members;
|
var all_members = cli.getRoom(this.props.roomId).currentState.members;
|
||||||
var all_user_ids = Object.keys(all_members);
|
var all_user_ids = Object.keys(all_members);
|
||||||
|
|
||||||
|
all_user_ids.sort(function(userIdA, userIdB) {
|
||||||
|
var userA = all_members[userIdA].user;
|
||||||
|
var userB = all_members[userIdB].user;
|
||||||
|
|
||||||
|
var latA = userA ? userA.lastActiveAgo || Number.MAX_VALUE : Number.MAX_VALUE;
|
||||||
|
var latB = userB ? userB.lastActiveAgo || Number.MAX_VALUE : Number.MAX_VALUE;
|
||||||
|
|
||||||
|
return latA - latB;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
var to_display = {};
|
var to_display = {};
|
||||||
var count = 0;
|
var count = 0;
|
||||||
for (var i = 0; i < all_user_ids.length && (limit === undefined || count < limit); ++i) {
|
for (var i = 0; i < all_user_ids.length && (limit === undefined || count < limit); ++i) {
|
||||||
|
|
Loading…
Reference in New Issue