From 70d1d23352e48aa1e409b8bfb0a9b6b5bdc8dc29 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sun, 24 Dec 2017 02:09:40 -0700 Subject: [PATCH] Appease the linter --- .../dimension/DimensionIntegrationsService.ts | 34 +++++++++---------- .../api/matrix/MatrixAppServiceApiService.ts | 4 +++ src-ts/db/AppserviceStore.ts | 6 ++-- src-ts/db/ScalarStore.ts | 5 ++- src-ts/db/WidgetStore.ts | 6 ++-- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src-ts/api/dimension/DimensionIntegrationsService.ts b/src-ts/api/dimension/DimensionIntegrationsService.ts index 3844ac4..52dfbef 100644 --- a/src-ts/api/dimension/DimensionIntegrationsService.ts +++ b/src-ts/api/dimension/DimensionIntegrationsService.ts @@ -20,6 +20,23 @@ export class DimensionIntegrationsService { DimensionIntegrationsService.integrationCache.clear(); } + public static getIntegrations(isEnabledCheck?: boolean): Promise { + const cachedResponse = DimensionIntegrationsService.integrationCache.get("integrations_" + isEnabledCheck); + if (cachedResponse) { + return cachedResponse; + } + const response = { + widgets: [], + }; + return Promise.resolve() + .then(() => WidgetStore.listAll(isEnabledCheck)) + .then(widgets => response.widgets = widgets) + + // Cache and return response + .then(() => DimensionIntegrationsService.integrationCache.put("integrations_" + isEnabledCheck, response)) + .then(() => response); + } + @GET @Path("enabled") public getEnabledIntegrations(@QueryParam("scalar_token") scalarToken: string): Promise { @@ -52,21 +69,4 @@ export class DimensionIntegrationsService { throw new ApiError(404, "Integration not found"); }); } - - public static getIntegrations(isEnabledCheck?: boolean): Promise { - const cachedResponse = DimensionIntegrationsService.integrationCache.get("integrations_" + isEnabledCheck); - if (cachedResponse) { - return cachedResponse; - } - const response = { - widgets: [], - }; - return Promise.resolve() - .then(() => WidgetStore.listAll(isEnabledCheck)) - .then(widgets => response.widgets = widgets) - - // Cache and return response - .then(() => DimensionIntegrationsService.integrationCache.put("integrations_" + isEnabledCheck, response)) - .then(() => response); - } } \ No newline at end of file diff --git a/src-ts/api/matrix/MatrixAppServiceApiService.ts b/src-ts/api/matrix/MatrixAppServiceApiService.ts index fc0c78a..505ad63 100644 --- a/src-ts/api/matrix/MatrixAppServiceApiService.ts +++ b/src-ts/api/matrix/MatrixAppServiceApiService.ts @@ -9,6 +9,10 @@ interface AppServiceTransaction { events: SimplifiedMatrixEvent[]; } +// Note: There's no actual defined prefix for this API. The following was chosen to be +// somewhat consistent with the other matrix APIs. In reality, the homeserver will just +// hit the URL given in the registration - be sure to define it to match this prefix. +// Eg: `url: "http://localhost:8184/_matrix/appservice/r0"` @Path("/_matrix/appservice/r0") export class MatrixAppServiceApiService { diff --git a/src-ts/db/AppserviceStore.ts b/src-ts/db/AppserviceStore.ts index 1748b4a..c454270 100644 --- a/src-ts/db/AppserviceStore.ts +++ b/src-ts/db/AppserviceStore.ts @@ -8,9 +8,6 @@ import config from "../config"; export class AppserviceStore { - private constructor() { - } - public static create(userPrefix: string): Promise { const id = "dimension-" + randomString({length: 25}); const asToken = randomString({length: 100}); @@ -60,4 +57,7 @@ export class AppserviceStore { }); }); } + + private constructor() { + } } \ No newline at end of file diff --git a/src-ts/db/ScalarStore.ts b/src-ts/db/ScalarStore.ts index 17bd37a..909fb5e 100644 --- a/src-ts/db/ScalarStore.ts +++ b/src-ts/db/ScalarStore.ts @@ -6,9 +6,6 @@ import User from "./models/User"; export class ScalarStore { - private constructor() { - } - public static doesUserHaveTokensForAllUpstreams(userId: string): Promise { let upstreamTokenIds: number[] = []; let hasDimensionToken = false; @@ -53,4 +50,6 @@ export class ScalarStore { }); } + private constructor() { + } } \ No newline at end of file diff --git a/src-ts/db/WidgetStore.ts b/src-ts/db/WidgetStore.ts index 3e8b37a..4c22a5b 100644 --- a/src-ts/db/WidgetStore.ts +++ b/src-ts/db/WidgetStore.ts @@ -5,9 +5,6 @@ import { resolveIfExists } from "./DimensionStore"; export class WidgetStore { - private constructor() { - } - public static listAll(isEnabled?: boolean): Promise { let conditions = {}; if (isEnabled === true || isEnabled === false) conditions = {where: {isEnabled: isEnabled}}; @@ -29,4 +26,7 @@ export class WidgetStore { }); } + private constructor() { + } + } \ No newline at end of file