Deduplicate members, key by userId
This commit is contained in:
parent
1cc427ba46
commit
d1db0d6426
1 changed files with 11 additions and 6 deletions
|
@ -106,12 +106,11 @@ export default withMatrixClient(React.createClass({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
memberList = memberList.map((m, index) => {
|
const uniqueMembers = {};
|
||||||
return (
|
memberList.forEach((m) => {
|
||||||
<GroupMemberTile key={index} groupId={this.props.groupId} member={m} />
|
if (!uniqueMembers[m.userId]) uniqueMembers[m.userId] = m;
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
memberList = Object.keys(uniqueMembers).map((userId) => uniqueMembers[userId]);
|
||||||
memberList.sort((a, b) => {
|
memberList.sort((a, b) => {
|
||||||
// TODO: should put admins at the top: we don't yet have that info
|
// TODO: should put admins at the top: we don't yet have that info
|
||||||
if (a < b) {
|
if (a < b) {
|
||||||
|
@ -123,10 +122,16 @@ export default withMatrixClient(React.createClass({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const memberTiles = memberList.map((m) => {
|
||||||
|
return (
|
||||||
|
<GroupMemberTile key={m.userId} groupId={this.props.groupId} member={m} />
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
return <TruncatedList className="mx_MemberList_wrapper" truncateAt={this.state.truncateAt}
|
return <TruncatedList className="mx_MemberList_wrapper" truncateAt={this.state.truncateAt}
|
||||||
createOverflowElement={this._createOverflowTile}
|
createOverflowElement={this._createOverflowTile}
|
||||||
>
|
>
|
||||||
{ memberList }
|
{ memberTiles }
|
||||||
</TruncatedList>;
|
</TruncatedList>;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue