Recent mention searches now OR terms instead of AND (#2931)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
9e07f4b021
Коммит
07126101d3
@@ -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');
|
||||
|
||||
@@ -114,6 +114,7 @@ class SearchBar extends React.Component {
|
||||
|
||||
client.search(
|
||||
terms,
|
||||
isMentionSearch,
|
||||
(data) => {
|
||||
this.setState({isSearching: false});
|
||||
if (utils.isMobile()) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user