From 77ae04140746779b5654662575fdaaf393e92d3d Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 13 Jan 2017 16:40:33 +0000 Subject: [PATCH] Order names by order of first events for users --- src/components/views/elements/MemberEventListSummary.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/views/elements/MemberEventListSummary.js b/src/components/views/elements/MemberEventListSummary.js index ab4a89eb69..89c7835671 100644 --- a/src/components/views/elements/MemberEventListSummary.js +++ b/src/components/views/elements/MemberEventListSummary.js @@ -239,12 +239,15 @@ module.exports = React.createClass({ let userEvents = { // $userId : [] }; + // Array of userIds ordered by the same ordering as the first event of each user + let users = []; eventsToRender.forEach((e) => { const userId = e.getStateKey(); // Initialise a user's events if (!userEvents[userId]) { userEvents[userId] = []; + users.push(userId); } userEvents[userId].push(e); }); @@ -258,7 +261,6 @@ module.exports = React.createClass({ }; let avatarMembers = []; - let users = Object.keys(userEvents); users.forEach( (userId) => { let displayName = userEvents[userId][0].getContent().displayname || userId;