diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js
index 7f089f6f9b..1dc2440913 100644
--- a/src/components/structures/RoomView.js
+++ b/src/components/structures/RoomView.js
@@ -479,8 +479,10 @@ module.exports = React.createClass({
self.setState({
highlights: highlights,
+ searchTerm: term,
searchResults: data,
searchScope: scope,
+ searchCount: data.search_categories.room_events.count,
});
}, function(error) {
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
@@ -505,10 +507,14 @@ module.exports = React.createClass({
var EventTile = sdk.getComponent('rooms.EventTile');
var self = this;
- if (this.state.searchResults &&
- this.state.searchResults.search_categories.room_events.results &&
- this.state.searchResults.search_categories.room_events.groups)
+ if (this.state.searchResults)
{
+ if (!this.state.searchResults.search_categories.room_events.results ||
+ !this.state.searchResults.search_categories.room_events.groups)
+ {
+ return ret;
+ }
+
// XXX: this dance is foul, due to the results API not directly returning sorted results
var results = this.state.searchResults.search_categories.room_events.results;
var roomIdGroups = this.state.searchResults.search_categories.room_events.groups.room_id;
@@ -985,15 +991,22 @@ module.exports = React.createClass({
;
}
- var messageComposer;
+ var messageComposer, searchInfo;
if (!this.state.searchResults) {
messageComposer =