Fix some lint errors.

pull/21833/head
Damir Jelić 2019-11-13 10:30:38 +01:00
parent 1cc64f2426
commit 1df28c7526
4 changed files with 11 additions and 12 deletions

View File

@ -32,7 +32,9 @@ class EventIndexPeg {
}
/**
* Returns the current Event index object for the application. Can be null
* Get the current event index.
*
* @Returns The EventIndex object for the application. Can be null
* if the platform doesn't support event indexing.
*/
get() {
@ -47,25 +49,25 @@ class EventIndexPeg {
const platform = PlatformPeg.get();
if (!platform.supportsEventIndexing()) return false;
let index = new EventIndex();
const index = new EventIndex();
const userId = MatrixClientPeg.get().getUserId();
// TODO log errors here and return false if it errors out.
await index.init(userId);
this.index = index;
return true
return true;
}
stop() {
if (this.index === null) return;
index.stop();
this.index.stop();
this.index = null;
}
async deleteEventIndex() {
if (this.index === null) return;
index.deleteEventIndex();
this.index.deleteEventIndex();
}
}

View File

@ -633,10 +633,10 @@ function _clearStorage() {
baseUrl: "",
});
const clear = async() => {
const clear = async () => {
await EventIndexPeg.deleteEventIndex();
await cli.clearStores();
}
};
return clear();
}

View File

@ -30,8 +30,6 @@ import {verificationMethods} from 'matrix-js-sdk/lib/crypto';
import MatrixClientBackedSettingsHandler from "./settings/handlers/MatrixClientBackedSettingsHandler";
import * as StorageManager from './utils/StorageManager';
import IdentityAuthClient from './IdentityAuthClient';
import PlatformPeg from "./PlatformPeg";
import EventIndexPeg from "./EventIndexPeg";
interface MatrixClientCreds {
homeserverUrl: string,

View File

@ -26,7 +26,7 @@ function serverSideSearch(term, roomId = undefined) {
};
}
let searchPromise = MatrixClientPeg.get().searchRoomEvents({
const searchPromise = MatrixClientPeg.get().searchRoomEvents({
filter: filter,
term: term,
});
@ -37,7 +37,6 @@ function serverSideSearch(term, roomId = undefined) {
async function combinedSearchFunc(searchTerm) {
// Create two promises, one for the local search, one for the
// server-side search.
const client = MatrixClientPeg.get();
const serverSidePromise = serverSideSearch(searchTerm);
const localPromise = localSearchFunc(searchTerm);
@ -126,7 +125,7 @@ function eventIndexSearch(term, roomId = undefined) {
searchPromise = combinedSearchFunc(term);
}
return searchPromise
return searchPromise;
}
export default function eventSearch(term, roomId = undefined) {