diff --git a/src/components/views/rooms/SearchBar.js b/src/components/views/rooms/SearchBar.js index d48cb0e08b..78c7e7bbb3 100644 --- a/src/components/views/rooms/SearchBar.js +++ b/src/components/views/rooms/SearchBar.js @@ -33,11 +33,11 @@ module.exports = React.createClass({ }, onThisRoomClick: function() { - this.setState({ scope: 'Room' }); + this.setState({ scope: 'Room' }, () => this._searchIfQuery()); }, onAllRoomsClick: function() { - this.setState({ scope: 'All' }); + this.setState({ scope: 'All' }, () => this._searchIfQuery()); }, onSearchChange: function(e) { @@ -49,6 +49,12 @@ module.exports = React.createClass({ } }, + _searchIfQuery: function() { + if (this.refs.search_term.value) { + this.onSearch(); + } + }, + onSearch: function() { this.props.onSearch(this.refs.search_term.value, this.state.scope); },