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;
|
||||
}
|
||||
|
||||
function eventIndexSearch(term, roomId = undefined) {
|
||||
const combinedSearchFunc = async (searchTerm) => {
|
||||
async function combinedSearchFunc(searchTerm) {
|
||||
// Create two promises, one for the local search, one for the
|
||||
// server-side search.
|
||||
const client = MatrixClientPeg.get();
|
||||
@@ -73,9 +72,9 @@ function eventIndexSearch(term, roomId = undefined) {
|
||||
serverSideResult.highlights);
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
const localSearchFunc = async (searchTerm, roomId = undefined) => {
|
||||
async function localSearchFunc(searchTerm, roomId = undefined) {
|
||||
const searchArgs = {
|
||||
search_term: searchTerm,
|
||||
before_limit: 1,
|
||||
@@ -106,8 +105,9 @@ function eventIndexSearch(term, roomId = undefined) {
|
||||
emptyResult, response);
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
function eventIndexSearch(term, roomId = undefined) {
|
||||
let searchPromise;
|
||||
|
||||
if (roomId !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user