Merge branch 'develop' into matthew/roompreview

This commit is contained in:
Kegan Dougal 2016-01-20 14:42:04 +00:00
commit edb67b778d

View file

@ -71,14 +71,8 @@ module.exports = React.createClass({
self.setState({ self.setState({
members: self.roomMembers() members: self.roomMembers()
}); });
// Lazy-load the complete user list for inviting new users // lazy load to prevent it blocking the first render
// TODO: Keep this list bleeding-edge up-to-date. Practically speaking, self._loadUserList();
// it will do for now not being updated as random new users join different
// rooms as this list will be reloaded every room swap.
var room = MatrixClientPeg.get().getRoom(self.props.roomId);
self.userList = MatrixClientPeg.get().getUsers().filter(function(u) {
return !room.hasMembershipState(u.userId, "join");
});
}, 50); }, 50);
@ -107,6 +101,21 @@ module.exports = React.createClass({
/*componentWillReceiveProps: function(newProps) { /*componentWillReceiveProps: function(newProps) {
},*/ },*/
_loadUserList: function() {
var room = MatrixClientPeg.get().getRoom(this.props.roomId);
if (!room) {
return; // we'll do it later
}
// Load the complete user list for inviting new users
// TODO: Keep this list bleeding-edge up-to-date. Practically speaking,
// it will do for now not being updated as random new users join different
// rooms as this list will be reloaded every room swap.
this.userList = MatrixClientPeg.get().getUsers().filter(function(u) {
return !room.hasMembershipState(u.userId, "join");
});
},
onRoom: function(room) { onRoom: function(room) {
if (room.roomId !== this.props.roomId) { if (room.roomId !== this.props.roomId) {
return; return;
@ -115,6 +124,7 @@ module.exports = React.createClass({
// we need to wait till the room is fully populated with state // we need to wait till the room is fully populated with state
// before refreshing the member list else we get a stale list. // before refreshing the member list else we get a stale list.
this._updateList(); this._updateList();
this._loadUserList();
}, },
onRoomStateMember: function(ev, state, member) { onRoomStateMember: function(ev, state, member) {