WIP search stuff

pull/296/head
Matthew Hodgson 2015-10-28 19:39:45 +00:00
parent 00a7ea994a
commit 0bfb1416c1
2 changed files with 16 additions and 6 deletions

View File

@ -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];

View File

@ -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 = <Loader/>;
}
else if (this.state.searching) {
aux = <SearchBar onCancelClick={this.onCancelClick}/>;
aux = <SearchBar ref="search_bar" onCancelClick={this.onCancelClick} onSearch={this.onSearch}/>;
}
var conferenceCallNotification = null;