Merge branch 'develop' into kegan/invite-autocompleting-race

This commit is contained in:
Kegan Dougal 2016-02-08 15:06:13 +00:00
commit 70ed0be389
2 changed files with 7 additions and 5 deletions

View file

@ -523,7 +523,7 @@ module.exports = React.createClass({
onRoomStateMember: function(ev, state, member) { onRoomStateMember: function(ev, state, member) {
if (member.roomId === this.props.roomId) { if (member.roomId === this.props.roomId) {
// a member state changed in this room, refresh the tab complete list // a member state changed in this room, refresh the tab complete list
this._updateTabCompleteList(this.state.room); this._updateTabCompleteList();
var room = MatrixClientPeg.get().getRoom(this.props.roomId); var room = MatrixClientPeg.get().getRoom(this.props.roomId);
if (!room) return; if (!room) return;
@ -606,7 +606,7 @@ module.exports = React.createClass({
roomView.addEventListener('dragend', this.onDragLeaveOrEnd); roomView.addEventListener('dragend', this.onDragLeaveOrEnd);
} }
this._updateTabCompleteList(this.state.room); this._updateTabCompleteList();
// XXX: EVIL HACK to autofocus inviting on empty rooms. // XXX: EVIL HACK to autofocus inviting on empty rooms.
// We use the setTimeout to avoid racing with focus_composer. // We use the setTimeout to avoid racing with focus_composer.
@ -620,12 +620,12 @@ module.exports = React.createClass({
} }
}, },
_updateTabCompleteList: new rate_limited_func(function(room) { _updateTabCompleteList: new rate_limited_func(function() {
if (!room || !this.tabComplete) { if (!this.state.room || !this.tabComplete) {
return; return;
} }
this.tabComplete.setCompletionList( this.tabComplete.setCompletionList(
MemberEntry.fromMemberList(room.getJoinedMembers()).concat( MemberEntry.fromMemberList(this.state.room.getJoinedMembers()).concat(
CommandEntry.fromCommands(SlashCommands.getCommandList()) CommandEntry.fromCommands(SlashCommands.getCommandList())
) )
); );

View file

@ -81,6 +81,8 @@ var SearchableEntityList = React.createClass({
var q = ev.target.value; var q = ev.target.value;
this.setState({ this.setState({
query: q, query: q,
// reset truncation if they back out the entire text
truncateAt: (q.length === 0 ? this.props.truncateAt : this.state.truncateAt),
results: this.getSearchResults(q, this.props.entities) results: this.getSearchResults(q, this.props.entities)
}, () => { }, () => {
// invoke the callback AFTER we've flushed the new state. We need to // invoke the callback AFTER we've flushed the new state. We need to