diff --git a/src/controllers/organisms/RoomView.js b/src/controllers/organisms/RoomView.js index 640816c2c..b05307d10 100644 --- a/src/controllers/organisms/RoomView.js +++ b/src/controllers/organisms/RoomView.js @@ -38,7 +38,7 @@ module.exports = { uploadingRoomSettings: false, numUnreadMessages: 0, draggingFile: false, - searching: false, + searchResults: [], } }, @@ -357,6 +357,16 @@ module.exports = { return WhoIsTyping.whoIsTypingString(this.state.room); }, + onSearch: function(term) { + MatrixClientPeg.get().searchMessageText(term).then(function(data) { + self.setState({ + searchResults: data, + }); + }, function(error) { + // TODO: show dialog or something + }); + }, + getEventTiles: function() { var DateSeparator = sdk.getComponent('molecules.DateSeparator'); @@ -365,6 +375,10 @@ module.exports = { var EventTile = sdk.getComponent('molecules.EventTile'); + if (this.state.searchResults.length) { + return ret; + } + for (var i = this.state.room.timeline.length-1; i >= 0 && count < this.state.messageCap; --i) { var mxEv = this.state.room.timeline[i]; diff --git a/src/skins/vector/views/organisms/RoomView.js b/src/skins/vector/views/organisms/RoomView.js index 1a23eba11..3406448c3 100644 --- a/src/skins/vector/views/organisms/RoomView.js +++ b/src/skins/vector/views/organisms/RoomView.js @@ -63,10 +63,6 @@ module.exports = React.createClass({ this.setState(this.getInitialState()); }, - onSearchClick: function() { - this.setState({searching: true}); - }, - onConferenceNotificationClick: function() { dis.dispatch({ action: 'place_call', @@ -203,7 +199,7 @@ module.exports = React.createClass({ aux = ; } else if (this.state.searching) { - aux = ; + aux = ; } var conferenceCallNotification = null;