Searching: Move the small helper functions out of the eventIndexSearch function.
parent
008554463d
commit
1cc64f2426
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue