Order names by order of first events for users
This commit is contained in:
parent
d2d78919ce
commit
77ae041407
1 changed files with 3 additions and 1 deletions
|
@ -239,12 +239,15 @@ module.exports = React.createClass({
|
||||||
let userEvents = {
|
let userEvents = {
|
||||||
// $userId : []
|
// $userId : []
|
||||||
};
|
};
|
||||||
|
// Array of userIds ordered by the same ordering as the first event of each user
|
||||||
|
let users = [];
|
||||||
|
|
||||||
eventsToRender.forEach((e) => {
|
eventsToRender.forEach((e) => {
|
||||||
const userId = e.getStateKey();
|
const userId = e.getStateKey();
|
||||||
// Initialise a user's events
|
// Initialise a user's events
|
||||||
if (!userEvents[userId]) {
|
if (!userEvents[userId]) {
|
||||||
userEvents[userId] = [];
|
userEvents[userId] = [];
|
||||||
|
users.push(userId);
|
||||||
}
|
}
|
||||||
userEvents[userId].push(e);
|
userEvents[userId].push(e);
|
||||||
});
|
});
|
||||||
|
@ -258,7 +261,6 @@ module.exports = React.createClass({
|
||||||
};
|
};
|
||||||
let avatarMembers = [];
|
let avatarMembers = [];
|
||||||
|
|
||||||
let users = Object.keys(userEvents);
|
|
||||||
users.forEach(
|
users.forEach(
|
||||||
(userId) => {
|
(userId) => {
|
||||||
let displayName = userEvents[userId][0].getContent().displayname || userId;
|
let displayName = userEvents[userId][0].getContent().displayname || userId;
|
||||||
|
|
Loading…
Reference in a new issue