mirror of https://github.com/vector-im/riot-web
Merge pull request #1522 from matrix-org/luke/fix-group-react-warnings
Fix some react warnings in GroupMemberListpull/21833/head
commit
ba46faf1b1
|
@ -59,6 +59,7 @@ export default withMatrixClient(React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
_fetchMembers: function() {
|
_fetchMembers: function() {
|
||||||
|
if (this._unmounted) return;
|
||||||
this.setState({
|
this.setState({
|
||||||
members: this._groupStore.getGroupMembers(),
|
members: this._groupStore.getGroupMembers(),
|
||||||
invitedMembers: this._groupStore.getGroupInvitedMembers(),
|
invitedMembers: this._groupStore.getGroupInvitedMembers(),
|
||||||
|
@ -105,12 +106,11 @@ export default withMatrixClient(React.createClass({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
memberList = memberList.map((m) => {
|
const uniqueMembers = {};
|
||||||
return (
|
memberList.forEach((m) => {
|
||||||
<GroupMemberTile key={m.userId} 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) {
|
||||||
|
@ -122,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 New Issue