diff --git a/app/views/SearchMessagesView/index.tsx b/app/views/SearchMessagesView/index.tsx index f24de99cd..9a7ed7d67 100644 --- a/app/views/SearchMessagesView/index.tsx +++ b/app/views/SearchMessagesView/index.tsx @@ -12,7 +12,6 @@ import RCTextInput from '../../containers/TextInput'; import ActivityIndicator from '../../containers/ActivityIndicator'; import Markdown from '../../containers/markdown'; import debounce from '../../utils/debounce'; -import RocketChat from '../../lib/rocketchat'; import Message from '../../containers/message'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; import { IMessage } from '../../containers/message/interfaces'; @@ -134,15 +133,15 @@ class SearchMessagesView extends React.Component { + searchMessages = (searchText: string) => { if (!searchText) { return []; } // If it's a encrypted, room we'll search only on the local stored messages + const db = database.active; + const likeString = sanitizeLikeString(searchText); if (this.encrypted) { - const db = database.active; const messagesCollection = db.get('messages'); - const likeString = sanitizeLikeString(searchText); return messagesCollection .query( // Messages of this room @@ -153,12 +152,15 @@ class SearchMessagesView extends React.Component { try {