Merge branch 'develop' into matthew/roompreview

This commit is contained in:
Kegan Dougal 2016-01-20 14:27:25 +00:00
commit a0aaae49dd
4 changed files with 20 additions and 23 deletions

View file

@ -121,7 +121,7 @@ module.exports = React.createClass({
var MemberAvatar = sdk.getComponent('avatars.MemberAvatar');
var BaseAvatar = sdk.getComponent('avatars.BaseAvatar');
var av = this.props.avatarJsx || <BaseAvatar name={name} width={36} height={36} />;
var av = this.props.avatarJsx || <BaseAvatar name={this.props.name} width={36} height={36} />;
return (
<div className={mainClassName} title={ this.props.title }

View file

@ -71,8 +71,19 @@ module.exports = React.createClass({
self.setState({
members: self.roomMembers()
});
// Lazy-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.
var room = MatrixClientPeg.get().getRoom(self.props.roomId);
self.userList = MatrixClientPeg.get().getUsers().filter(function(u) {
return !room.hasMembershipState(u.userId, "join");
});
}, 50);
setTimeout
// Attach a SINGLE listener for global presence changes then locate the
// member tile and re-render it. This is more efficient than every tile
// evar attaching their own listener.
@ -296,7 +307,6 @@ module.exports = React.createClass({
// member invite (content.third_party_invite.signed.token)
var room = MatrixClientPeg.get().getRoom(this.props.roomId);
var EntityTile = sdk.getComponent("rooms.EntityTile");
var BaseAvatar = sdk.getComponent("avatars.BaseAvatar");
if (room) {
room.currentState.getStateEvents("m.room.third_party_invite").forEach(
function(e) {
@ -306,12 +316,9 @@ module.exports = React.createClass({
if (memberEvent) {
return;
}
var avatarJsx = (
<BaseAvatar name={e.getContent().display_name} width={36} height={36} />
);
memberList.push(
<EntityTile key={e.getStateKey()} ref={e.getStateKey()}
name={e.getContent().display_name} avatarJsx={avatarJsx} />
name={e.getContent().display_name} />
)
})
}
@ -327,21 +334,13 @@ module.exports = React.createClass({
<Loader />
);
} else {
// TODO: Cache this calculation
var room = MatrixClientPeg.get().getRoom(this.props.roomId);
if (!room) return <div></div>;
/* var allUsers = MatrixClientPeg.get().getUsers();
// only add Users if they are not joined
allUsers = allUsers.filter(function(u) {
return !room.hasMembershipState(u.userId, "join");
}); */
var SearchableEntityList = sdk.getComponent("rooms.SearchableEntityList");
return (
<SearchableEntityList searchPlaceholderText={"Invite / Search"}
onSubmit={this.onInvite}
onQueryChanged={this.onSearchQueryChanged}
entities={[] /* Entities.fromUsers(allUsers, true, this.onInvite) */} />
entities={Entities.fromUsers(this.userList || [], true, this.onInvite)} />
);
}
},

View file

@ -79,14 +79,6 @@ module.exports = React.createClass({
var av = (
<MemberAvatar member={member} width={36} height={36} />
);
var power;
var powerLevel = this.props.member.powerLevel;
if (powerLevel >= 50 && powerLevel < 99) {
power = <img src="img/mod.svg" className="mx_MemberTile_power" width="16" height="17" alt="Mod"/>;
}
if (powerLevel >= 99) {
power = <img src="img/admin.svg" className="mx_MemberTile_power" width="16" height="17" alt="Admin"/>;
}
if (member.user) {
this.user_last_modified_time = member.user.getLastModifiedTime();

View file

@ -50,6 +50,12 @@ var SearchableEntityList = React.createClass({
};
},
componentWillUnmount: function() {
// pretend the query box was blanked out else filters could still be
// applied to other components which rely on onQueryChanged.
this.props.onQueryChanged("");
},
/**
* Public-facing method to set the input query text to the given input.
* @param {string} input