Fix some lint errors.
This commit is contained in:
parent
1cc64f2426
commit
1df28c7526
4 changed files with 11 additions and 12 deletions
|
@ -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.
|
* if the platform doesn't support event indexing.
|
||||||
*/
|
*/
|
||||||
get() {
|
get() {
|
||||||
|
@ -47,25 +49,25 @@ class EventIndexPeg {
|
||||||
const platform = PlatformPeg.get();
|
const platform = PlatformPeg.get();
|
||||||
if (!platform.supportsEventIndexing()) return false;
|
if (!platform.supportsEventIndexing()) return false;
|
||||||
|
|
||||||
let index = new EventIndex();
|
const index = new EventIndex();
|
||||||
|
|
||||||
const userId = MatrixClientPeg.get().getUserId();
|
const userId = MatrixClientPeg.get().getUserId();
|
||||||
// TODO log errors here and return false if it errors out.
|
// TODO log errors here and return false if it errors out.
|
||||||
await index.init(userId);
|
await index.init(userId);
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
if (this.index === null) return;
|
if (this.index === null) return;
|
||||||
index.stop();
|
this.index.stop();
|
||||||
this.index = null;
|
this.index = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteEventIndex() {
|
async deleteEventIndex() {
|
||||||
if (this.index === null) return;
|
if (this.index === null) return;
|
||||||
index.deleteEventIndex();
|
this.index.deleteEventIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -633,10 +633,10 @@ function _clearStorage() {
|
||||||
baseUrl: "",
|
baseUrl: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const clear = async() => {
|
const clear = async () => {
|
||||||
await EventIndexPeg.deleteEventIndex();
|
await EventIndexPeg.deleteEventIndex();
|
||||||
await cli.clearStores();
|
await cli.clearStores();
|
||||||
}
|
};
|
||||||
|
|
||||||
return clear();
|
return clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,6 @@ import {verificationMethods} from 'matrix-js-sdk/lib/crypto';
|
||||||
import MatrixClientBackedSettingsHandler from "./settings/handlers/MatrixClientBackedSettingsHandler";
|
import MatrixClientBackedSettingsHandler from "./settings/handlers/MatrixClientBackedSettingsHandler";
|
||||||
import * as StorageManager from './utils/StorageManager';
|
import * as StorageManager from './utils/StorageManager';
|
||||||
import IdentityAuthClient from './IdentityAuthClient';
|
import IdentityAuthClient from './IdentityAuthClient';
|
||||||
import PlatformPeg from "./PlatformPeg";
|
|
||||||
import EventIndexPeg from "./EventIndexPeg";
|
|
||||||
|
|
||||||
interface MatrixClientCreds {
|
interface MatrixClientCreds {
|
||||||
homeserverUrl: string,
|
homeserverUrl: string,
|
||||||
|
|
|
@ -26,7 +26,7 @@ function serverSideSearch(term, roomId = undefined) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let searchPromise = MatrixClientPeg.get().searchRoomEvents({
|
const searchPromise = MatrixClientPeg.get().searchRoomEvents({
|
||||||
filter: filter,
|
filter: filter,
|
||||||
term: term,
|
term: term,
|
||||||
});
|
});
|
||||||
|
@ -37,7 +37,6 @@ function serverSideSearch(term, roomId = undefined) {
|
||||||
async function combinedSearchFunc(searchTerm) {
|
async function combinedSearchFunc(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 serverSidePromise = serverSideSearch(searchTerm);
|
const serverSidePromise = serverSideSearch(searchTerm);
|
||||||
const localPromise = localSearchFunc(searchTerm);
|
const localPromise = localSearchFunc(searchTerm);
|
||||||
|
|
||||||
|
@ -126,7 +125,7 @@ function eventIndexSearch(term, roomId = undefined) {
|
||||||
searchPromise = combinedSearchFunc(term);
|
searchPromise = combinedSearchFunc(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
return searchPromise
|
return searchPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function eventSearch(term, roomId = undefined) {
|
export default function eventSearch(term, roomId = undefined) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue