summaryrefslogtreecommitdiffstats
path: root/webapp/components/search_bar.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/search_bar.jsx')
-rw-r--r--webapp/components/search_bar.jsx31
1 files changed, 11 insertions, 20 deletions
diff --git a/webapp/components/search_bar.jsx b/webapp/components/search_bar.jsx
index a7e9bfcac..c5fcd4697 100644
--- a/webapp/components/search_bar.jsx
+++ b/webapp/components/search_bar.jsx
@@ -2,9 +2,6 @@
// See License.txt for license information.
import $ from 'jquery';
-import ReactDOM from 'react-dom';
-import Client from 'client/web_client.jsx';
-import * as AsyncClient from 'utils/async_client.jsx';
import * as GlobalActions from 'actions/global_actions.jsx';
import SearchStore from 'stores/search_store.jsx';
import UserStore from 'stores/user_store.jsx';
@@ -15,7 +12,7 @@ import SearchSuggestionList from './suggestion/search_suggestion_list.jsx';
import SearchUserProvider from './suggestion/search_user_provider.jsx';
import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
-import {loadProfilesForPosts, getFlaggedPosts} from 'actions/post_actions.jsx';
+import {getFlaggedPosts, performSearch} from 'actions/post_actions.jsx';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
@@ -119,26 +116,18 @@ export default class SearchBar extends React.Component {
if (terms.length) {
this.setState({isSearching: true});
- Client.search(
+ performSearch(
terms,
isMentionSearch,
- (data) => {
+ () => {
this.setState({isSearching: false});
- if (Utils.isMobile()) {
- ReactDOM.findDOMNode(this.refs.search).value = '';
- }
-
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_SEARCH,
- results: data,
- is_mention_search: isMentionSearch
- });
- loadProfilesForPosts(data.posts);
+ if (Utils.isMobile() && this.search) {
+ this.search.value = '';
+ }
},
- (err) => {
+ () => {
this.setState({isSearching: false});
- AsyncClient.dispatchError(err, 'search');
}
);
}
@@ -147,7 +136,7 @@ export default class SearchBar extends React.Component {
handleSubmit(e) {
e.preventDefault();
this.performSearch(this.state.searchTerm.trim());
- $(ReactDOM.findDOMNode(this.refs.search)).find('input').blur();
+ $(this.search).find('input').blur();
this.clearFocus();
}
@@ -276,7 +265,9 @@ export default class SearchBar extends React.Component {
>
<span className='fa fa-search sidebar__search-icon'/>
<SuggestionBox
- ref='search'
+ ref={(search) => {
+ this.search = search;
+ }}
className='form-control search-bar'
placeholder={Utils.localizeMessage('search_bar.search', 'Search')}
value={this.state.searchTerm}