File tree Expand file tree Collapse file tree
skins/vector/views/organisms Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ module.exports = {
3838 uploadingRoomSettings : false ,
3939 numUnreadMessages : 0 ,
4040 draggingFile : false ,
41- searching : false ,
41+ searchResults : [ ] ,
4242 }
4343 } ,
4444
@@ -357,6 +357,16 @@ module.exports = {
357357 return WhoIsTyping . whoIsTypingString ( this . state . room ) ;
358358 } ,
359359
360+ onSearch : function ( term ) {
361+ MatrixClientPeg . get ( ) . searchMessageText ( term ) . then ( function ( data ) {
362+ self . setState ( {
363+ searchResults : data ,
364+ } ) ;
365+ } , function ( error ) {
366+ // TODO: show dialog or something
367+ } ) ;
368+ } ,
369+
360370 getEventTiles : function ( ) {
361371 var DateSeparator = sdk . getComponent ( 'molecules.DateSeparator' ) ;
362372
@@ -365,6 +375,10 @@ module.exports = {
365375
366376 var EventTile = sdk . getComponent ( 'molecules.EventTile' ) ;
367377
378+ if ( this . state . searchResults . length ) {
379+ return ret ;
380+ }
381+
368382 for ( var i = this . state . room . timeline . length - 1 ; i >= 0 && count < this . state . messageCap ; -- i ) {
369383 var mxEv = this . state . room . timeline [ i ] ;
370384
Original file line number Diff line number Diff line change @@ -63,10 +63,6 @@ module.exports = React.createClass({
6363 this . setState ( this . getInitialState ( ) ) ;
6464 } ,
6565
66- onSearchClick : function ( ) {
67- this . setState ( { searching : true } ) ;
68- } ,
69-
7066 onConferenceNotificationClick : function ( ) {
7167 dis . dispatch ( {
7268 action : 'place_call' ,
@@ -203,7 +199,7 @@ module.exports = React.createClass({
203199 aux = < Loader /> ;
204200 }
205201 else if ( this . state . searching ) {
206- aux = < SearchBar onCancelClick = { this . onCancelClick } /> ;
202+ aux = < SearchBar ref = "search_bar" onCancelClick = { this . onCancelClick } onSearch = { this . onSearch } /> ;
207203 }
208204
209205 var conferenceCallNotification = null ;
You can’t perform that action at this time.
0 commit comments