diff --git a/src/matrixeventprocessor.ts b/src/matrixeventprocessor.ts index b294bba5..1080345b 100644 --- a/src/matrixeventprocessor.ts +++ b/src/matrixeventprocessor.ts @@ -268,7 +268,7 @@ export class MatrixEventProcessor { msg += `invited \`${event.state_key}\` to the room`; } else if (membership === "leave" && event.state_key !== event.sender && allowKick) { msg += `kicked \`${event.state_key}\` from the room`; - } else if (membership === "leave" && allowJoinLeave) { + } else if (membership === "leave" && event.state_key === event.sender && allowJoinLeave) { msg += "left the room"; } else if (membership === "ban" && allowBan) { msg += `banned \`${event.state_key}\` from the room`; diff --git a/test/test_matrixeventprocessor.ts b/test/test_matrixeventprocessor.ts index e06fea32..ff2f8e40 100644 --- a/test/test_matrixeventprocessor.ts +++ b/test/test_matrixeventprocessor.ts @@ -344,9 +344,9 @@ describe("MatrixEventProcessor", () => { expect(STATE_EVENT_MSG).to.equal("`@user:localhost` set the name to `Test Name` on Matrix."); }); it("Should not echo name changes", async () => { - const config = new DiscordBridgeConfig(); - config.bridge.disableRoomNameNotifications = true; - const {processor} = createMatrixEventProcessor(); + const bridge = new DiscordBridgeConfigBridge(); + bridge.disableRoomNameNotifications = true; + const {processor} = createMatrixEventProcessor(0, bridge); const event = { content: { name: "Test Name", @@ -453,8 +453,8 @@ describe("MatrixEventProcessor", () => { expect(STATE_EVENT_MSG).to.equal("`@user:localhost` kicked `@user2:localhost` from the room on Matrix."); }); it("Should not echo kicks", async () => { - const config = new DiscordBridgeConfig(); - config.bridge.disableKickNotifications = true; + const bridge = new DiscordBridgeConfigBridge(); + bridge.disableKickNotifications = true; const {processor} = createMatrixEventProcessor(0, bridge); const event = { content: { @@ -510,8 +510,8 @@ describe("MatrixEventProcessor", () => { expect(STATE_EVENT_MSG).to.equal("`@user:localhost` banned `@user2:localhost` from the room on Matrix."); }); it("Should not echo bans", async () => { - const config = new DiscordBridgeConfig(); - config.bridge.disableBanNotifications = true; + const bridge = new DiscordBridgeConfigBridge(); + bridge.disableBanNotifications = true; const {processor} = createMatrixEventProcessor(0, bridge); const event = { content: {