From 07126101d379b900724c7c5cfc82070b42c235d6 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 9 May 2016 12:00:08 -0400 Subject: Recent mention searches now OR terms instead of AND (#2931) --- webapp/client/client.jsx | 10 +++++++--- webapp/components/search_bar.jsx | 1 + webapp/tests/client_post.test.jsx | 1 + webapp/utils/async_client.jsx | 5 +++-- 4 files changed, 12 insertions(+), 5 deletions(-) (limited to 'webapp') diff --git a/webapp/client/client.jsx b/webapp/client/client.jsx index 9bcbeed4e..5d0dd07c9 100644 --- a/webapp/client/client.jsx +++ b/webapp/client/client.jsx @@ -1267,13 +1267,17 @@ export default class Client { this.track('api', 'api_posts_delete'); } - search = (terms, success, error) => { + search = (terms, isOrSearch, success, error) => { + const data = {}; + data.terms = terms; + data.is_or_search = isOrSearch; + request. - get(`${this.getTeamNeededRoute()}/posts/search`). + post(`${this.getTeamNeededRoute()}/posts/search`). set(this.defaultHeaders). type('application/json'). accept('application/json'). - query({terms}). + send(data). end(this.handleResponse.bind(this, 'search', success, error)); this.track('api', 'api_posts_search'); diff --git a/webapp/components/search_bar.jsx b/webapp/components/search_bar.jsx index 1156ac0f1..6ebb9cfdc 100644 --- a/webapp/components/search_bar.jsx +++ b/webapp/components/search_bar.jsx @@ -114,6 +114,7 @@ class SearchBar extends React.Component { client.search( terms, + isMentionSearch, (data) => { this.setState({isSearching: false}); if (utils.isMobile()) { diff --git a/webapp/tests/client_post.test.jsx b/webapp/tests/client_post.test.jsx index db48e4000..c8e6fad0f 100644 --- a/webapp/tests/client_post.test.jsx +++ b/webapp/tests/client_post.test.jsx @@ -102,6 +102,7 @@ describe('Client.Posts', function() { TestHelper.initBasic(() => { TestHelper.basicClient().search( 'unit test', + false, function(data) { assert.equal(data.order[0], TestHelper.basicPost().id); done(); diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index 1dcead326..a562964b1 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -467,7 +467,7 @@ export function getAllTeamListings() { ); } -export function search(terms) { +export function search(terms, isOrSearch) { if (isCallInProgress('search_' + String(terms))) { return; } @@ -475,6 +475,7 @@ export function search(terms) { callTracker['search_' + String(terms)] = utils.getTimestamp(); Client.search( terms, + isOrSearch, (data) => { callTracker['search_' + String(terms)] = 0; @@ -1370,4 +1371,4 @@ export function getPublicLink(filename, success, error) { } } ); -} \ No newline at end of file +} -- cgit v1.2.3-1-g7c22