From 0bfb1416c1e7c518aed4b0870a368b7e12bd7f9a Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 28 Oct 2015 19:39:45 +0000 Subject: [PATCH] WIP search stuff --- src/controllers/organisms/RoomView.js | 16 +++++++++++++++- src/skins/vector/views/organisms/RoomView.js | 6 +----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/controllers/organisms/RoomView.js b/src/controllers/organisms/RoomView.js index 640816c2cc..b05307d10e 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 1a23eba111..3406448c3a 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;