From 54307eb11b7a190805c67908991dfb46944d521f Mon Sep 17 00:00:00 2001 From: Christian Paul <christianp@matrix.org> Date: Wed, 9 Dec 2020 16:38:32 +0100 Subject: [PATCH] Remove provisioner as a parameter of MatrixRoomHandler --- src/bot.ts | 2 +- src/matrixroomhandler.ts | 5 ----- test/test_matrixroomhandler.ts | 19 +------------------ 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/src/bot.ts b/src/bot.ts index 4969b88..e96fac5 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -94,7 +94,7 @@ export class DiscordBot { this.clientFactory = new DiscordClientFactory(store, config.auth); this.discordMsgProcessor = new DiscordMessageProcessor(config.bridge.domain, this); this.presenceHandler = new PresenceHandler(this); - this.roomHandler = new MatrixRoomHandler(this, config, this.provisioner, bridge, store.roomStore); + this.roomHandler = new MatrixRoomHandler(this, config, bridge, store.roomStore); this.channelSync = new ChannelSyncroniser(bridge, config, this, store.roomStore); this.provisioner = new Provisioner(store.roomStore, this.channelSync); this.mxEventProcessor = new MatrixEventProcessor( diff --git a/src/matrixroomhandler.ts b/src/matrixroomhandler.ts index 5a7c4b8..02e69f3 100644 --- a/src/matrixroomhandler.ts +++ b/src/matrixroomhandler.ts @@ -19,7 +19,6 @@ import { DiscordBridgeConfig } from "./config"; import * as Discord from "better-discord.js"; import { Util } from "./util"; -import { Provisioner } from "./provisioner"; import { Log } from "./log"; const log = new Log("MatrixRoomHandler"); import { DbRoomStore, MatrixStoreRoom, RemoteStoreRoom } from "./db/roomstore"; @@ -47,16 +46,12 @@ const JOIN_ROOM_SCHEDULE = [ export class MatrixRoomHandler { private botUserId: string; - private botJoinedRooms: Set<string>; // roomids - private botJoinedRoomsCacheUpdatedAt = 0; constructor( private discord: DiscordBot, private config: DiscordBridgeConfig, - private provisioner: Provisioner, private bridge: Appservice, private roomStore: DbRoomStore) { this.botUserId = this.discord.BotUserId; - this.botJoinedRooms = new Set(); } public bindThirdparty() { diff --git a/test/test_matrixroomhandler.ts b/test/test_matrixroomhandler.ts index 5a25d01..eda5360 100644 --- a/test/test_matrixroomhandler.ts +++ b/test/test_matrixroomhandler.ts @@ -105,23 +105,6 @@ function createRH(opts: any = {}) { } else { config.bridge.enableSelfServiceBridging = true; } - const provisioner = { - AskBridgePermission: async () => { - if (opts.denyBridgePermission) { - throw new Error("The bridge has been declined by the Discord guild"); - } - }, - BridgeMatrixRoom: () => { - if (opts.failBridgeMatrix) { - throw new Error("Test failed matrix bridge"); - } - }, - UnbridgeRoom: async () => { - if (opts.failUnbridge) { - throw new Error("Test failed unbridge"); - } - }, - }; const store = { getEntriesByMatrixId: (matrixId) => { return [{ @@ -136,7 +119,7 @@ function createRH(opts: any = {}) { }, }; - const handler = new RoomHandler(bot as any, config, provisioner as any, bridge as any, store); + const handler = new RoomHandler(bot as any, config, bridge as any, store); return { handler, bridge }; } -- GitLab