From cc921779ae11facf6e07757a6abb6610253946f3 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sat, 24 Mar 2018 15:05:26 -0600 Subject: [PATCH] Appease the linter --- src/db/NebStore.ts | 28 ++++++++++++++-------------- src/neb/NebClient.ts | 16 ++++++++-------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/db/NebStore.ts b/src/db/NebStore.ts index 32583cd..367a347 100644 --- a/src/db/NebStore.ts +++ b/src/db/NebStore.ts @@ -87,45 +87,45 @@ export class NebStore { } public static async getConfig(id: number): Promise { - const config = await NebConfiguration.findByPrimary(id); - if (!config) throw new Error("Configuration not found"); + const nebConfig = await NebConfiguration.findByPrimary(id); + if (!nebConfig) throw new Error("Configuration not found"); const integrations = await NebIntegration.findAll({where: {nebId: id}}); - const fullIntegrations = await NebStore.getCompleteIntegrations(config, integrations); + const fullIntegrations = await NebStore.getCompleteIntegrations(nebConfig, integrations); - return new NebConfig(config, fullIntegrations); + return new NebConfig(nebConfig, fullIntegrations); } public static async createForUpstream(upstreamId: number): Promise { const upstream = await Upstream.findByPrimary(upstreamId); if (!upstream) throw new Error("Upstream not found"); - const config = await NebConfiguration.create({ + const nebConfig = await NebConfiguration.create({ upstreamId: upstream.id, }); - return NebStore.getConfig(config.id); + return NebStore.getConfig(nebConfig.id); } public static async createForAppservice(appserviceId: string, adminUrl: string): Promise { const appservice = await AppService.findByPrimary(appserviceId); if (!appservice) throw new Error("Appservice not found"); - const config = await NebConfiguration.create({ + const nebConfig = await NebConfiguration.create({ appserviceId: appservice.id, adminUrl: adminUrl, }); - return NebStore.getConfig(config.id); + return NebStore.getConfig(nebConfig.id); } public static async getOrCreateIntegration(configurationId: number, integrationType: string): Promise { if (!NebStore.INTEGRATIONS[integrationType]) throw new Error("Integration not supported"); - const config = await NebConfiguration.findByPrimary(configurationId); - if (!config) throw new Error("Configuration not found"); + const nebConfig = await NebConfiguration.findByPrimary(configurationId); + if (!nebConfig) throw new Error("Configuration not found"); - let integration = await NebIntegration.findOne({where: {nebId: config.id, type: integrationType}}); + let integration = await NebIntegration.findOne({where: {nebId: nebConfig.id, type: integrationType}}); if (!integration) { LogService.info("NebStore", "Creating integration " + integrationType + " for NEB " + configurationId); integration = await NebIntegration.create({ @@ -171,9 +171,9 @@ export class NebStore { for (const type of Object.keys(NebStore.INTEGRATIONS)) { if (nebConfig.upstreamId && NebStore.INTEGRATIONS_MODULAR_SUPPORTED.indexOf(type) === -1) continue; - const config = JSON.parse(JSON.stringify(NebStore.INTEGRATIONS[type])); - config["type"] = type; - result.push(config); + const integrationConfig = JSON.parse(JSON.stringify(NebStore.INTEGRATIONS[type])); + integrationConfig["type"] = type; + result.push(integrationConfig); } return result; diff --git a/src/neb/NebClient.ts b/src/neb/NebClient.ts index 7905a80..6a606ba 100644 --- a/src/neb/NebClient.ts +++ b/src/neb/NebClient.ts @@ -17,7 +17,7 @@ export class NebClient { } public async updateUser(userId: string, isEnabled: boolean, sync = true, autoAcceptInvites = true): Promise { - const request: Client = { + const nebRequest: Client = { UserID: userId, HomeserverURL: await getFederationUrl(config.homeserver.name), AccessToken: (isEnabled ? await this.getAccessToken(userId) : "DISABLED"), @@ -25,25 +25,25 @@ export class NebClient { AutoJoinRooms: autoAcceptInvites }; - return this.doRequest("/admin/configureClient", request); + return this.doRequest("/admin/configureClient", nebRequest); } - public async setServiceConfig(serviceId: string, userId: string, type: string, config: any): Promise { - const request: Service = { + public async setServiceConfig(serviceId: string, userId: string, type: string, serviceConfig: any): Promise { + const nebRequest: Service = { ID: serviceId, Type: type, UserID: userId, - Config: config, + Config: serviceConfig, }; - return this.doRequest("/admin/configureService", request); + return this.doRequest("/admin/configureService", nebRequest); } public async getServiceConfig(serviceId: string): Promise { - const request = {ID: serviceId}; + const nebRequest = {ID: serviceId}; try { - const service = await this.doRequest("/admin/getService", request); + const service = await this.doRequest("/admin/getService", nebRequest); return service.Config; } catch (err) { LogService.error("NebClient", err);