You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Searching: Move the small helper functions out of the eventIndexSearch function.
This commit is contained in:
@@ -34,8 +34,7 @@ function serverSideSearch(term, roomId = undefined) {
|
|||||||
return searchPromise;
|
return searchPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function eventIndexSearch(term, roomId = undefined) {
|
async function combinedSearchFunc(searchTerm) {
|
||||||
const combinedSearchFunc = async (searchTerm) => {
|
|
||||||
// Create two promises, one for the local search, one for the
|
// Create two promises, one for the local search, one for the
|
||||||
// server-side search.
|
// server-side search.
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
@@ -73,9 +72,9 @@ function eventIndexSearch(term, roomId = undefined) {
|
|||||||
serverSideResult.highlights);
|
serverSideResult.highlights);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
}
|
||||||
|
|
||||||
const localSearchFunc = async (searchTerm, roomId = undefined) => {
|
async function localSearchFunc(searchTerm, roomId = undefined) {
|
||||||
const searchArgs = {
|
const searchArgs = {
|
||||||
search_term: searchTerm,
|
search_term: searchTerm,
|
||||||
before_limit: 1,
|
before_limit: 1,
|
||||||
@@ -106,8 +105,9 @@ function eventIndexSearch(term, roomId = undefined) {
|
|||||||
emptyResult, response);
|
emptyResult, response);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
function eventIndexSearch(term, roomId = undefined) {
|
||||||
let searchPromise;
|
let searchPromise;
|
||||||
|
|
||||||
if (roomId !== undefined) {
|
if (roomId !== undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user