Enable clicking on search results to switch to the result in context.
This commit is contained in:
parent
223675bafb
commit
e747beac58
1 changed files with 12 additions and 1 deletions
|
@ -205,6 +205,8 @@ module.exports = React.createClass({
|
|||
|
||||
this.setState({
|
||||
events: [],
|
||||
searchResults: null, // we may have arrived here by clicking on a
|
||||
// search result. Hide the results.
|
||||
timelineLoading: true,
|
||||
});
|
||||
|
||||
|
@ -853,6 +855,14 @@ module.exports = React.createClass({
|
|||
});
|
||||
},
|
||||
|
||||
_onSearchResultSelected: function(result) {
|
||||
var event = result.context.getEvent();
|
||||
dis.dispatch({
|
||||
action: 'view_room',
|
||||
room_id: event.getRoomId(),
|
||||
event_id: event.getId(),
|
||||
});
|
||||
},
|
||||
|
||||
getSearchResultTiles: function() {
|
||||
var EventTile = sdk.getComponent('rooms.EventTile');
|
||||
|
@ -916,7 +926,8 @@ module.exports = React.createClass({
|
|||
|
||||
ret.push(<SearchResultTile key={mxEv.getId()}
|
||||
searchResult={result}
|
||||
searchHighlights={this.state.searchHighlights}/>);
|
||||
searchHighlights={this.state.searchHighlights}
|
||||
onSelect={this._onSearchResultSelected.bind(this, result)}/>);
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue