From 52f6fa89a1271f6fc07473766733ff6034731f62 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 24 Jun 2015 13:48:39 +0100 Subject: [PATCH] Only show joined and invited members --- src/controllers/organisms/MemberList.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/controllers/organisms/MemberList.js b/src/controllers/organisms/MemberList.js index 3c10c9a68f..f3728547ee 100644 --- a/src/controllers/organisms/MemberList.js +++ b/src/controllers/organisms/MemberList.js @@ -24,8 +24,9 @@ module.exports = { var cli = MatrixClientPeg.get(); cli.on("RoomState.members", this.onRoomStateMember); + var members = this.roomMembers(); this.setState({ - memberDict: cli.getRoom(this.props.roomId).currentState.members + memberDict: members }); }, @@ -40,10 +41,25 @@ module.exports = { },*/ onRoomStateMember: function(ev, state, member) { - var cli = MatrixClientPeg.get(); + var members = this.roomMembers(); this.setState({ - memberDict: cli.getRoom(this.props.roomId).currentState.members + memberDict: members }); + }, + + roomMembers() { + var cli = MatrixClientPeg.get(); + var all_members = cli.getRoom(this.props.roomId).currentState.members; + var to_display = {}; + for (var i = 0; i < Object.keys(all_members).length; ++i) { + var user_id = Object.keys(all_members)[i]; + var m = all_members[user_id]; + + if (m.membership == 'join' || m.membership == 'invite') { + to_display[user_id] = m; + } + } + return to_display; } };