From c7ba7450816f63c7970ee618aa05cc3d7aaa8d50 Mon Sep 17 00:00:00 2001 From: gnuxie Date: Mon, 17 Oct 2022 11:24:02 +0100 Subject: [PATCH] Stop ProtectedRoomsSet verifying permissions for unprotected rooms. --- src/ProtectedRoomsSet.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ProtectedRoomsSet.ts b/src/ProtectedRoomsSet.ts index 6a3fe833..192fdc9a 100644 --- a/src/ProtectedRoomsSet.ts +++ b/src/ProtectedRoomsSet.ts @@ -173,6 +173,9 @@ export class ProtectedRoomsSet { if (event['sender'] === this.clientUserId) { throw new TypeError("`ProtectedRooms::handleEvent` should not be used to inform about events sent by mjolnir."); } + if (!this.protectedRooms.has(roomId)) { + return; // We're not protecting this room. + } this.protectedRoomActivityTracker.handleEvent(roomId, event); if (event['type'] === 'm.room.power_levels' && event['state_key'] === '') { // power levels were updated - recheck permissions