Searching: Move the small helper functions out of the eventIndexSearch function.

pull/21833/head
Damir Jelić 2019-11-13 10:10:35 +01:00
parent 008554463d
commit 1cc64f2426
1 changed files with 73 additions and 73 deletions

View File

@ -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) {