Merge pull request #131 from matrix-org/rav/search_clickthrough
Enable clicking on search results to switch to the result in context.pull/21833/head
commit
309f1e2c8f
|
@ -214,6 +214,8 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
events: [],
|
events: [],
|
||||||
|
searchResults: null, // we may have arrived here by clicking on a
|
||||||
|
// search result. Hide the results.
|
||||||
timelineLoading: true,
|
timelineLoading: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -863,6 +865,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() {
|
getSearchResultTiles: function() {
|
||||||
var EventTile = sdk.getComponent('rooms.EventTile');
|
var EventTile = sdk.getComponent('rooms.EventTile');
|
||||||
|
@ -926,7 +936,8 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
ret.push(<SearchResultTile key={mxEv.getId()}
|
ret.push(<SearchResultTile key={mxEv.getId()}
|
||||||
searchResult={result}
|
searchResult={result}
|
||||||
searchHighlights={this.state.searchHighlights}/>);
|
searchHighlights={this.state.searchHighlights}
|
||||||
|
onSelect={this._onSearchResultSelected.bind(this, result)}/>);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue