From 410ceebd62933441db5a5d9a5a82ca2a6b7d8309 Mon Sep 17 00:00:00 2001 From: Gnuxie <50846879+Gnuxie@users.noreply.github.com> Date: Tue, 22 Nov 2022 15:34:50 +0000 Subject: [PATCH] Stop Mjolnir blindly protecting all policy lists at startup. (#431) `Mjolnir.resyncAllJoinedRooms` needs policy lists to be loaded into mjolnir in order to filter them out of the protect rooms set (unless explicitly protected). This is so that you don't end up having mjolnir complain about protecting a list which you have no control over, and are just watching (e.g. #matrix-org-coc-bl:matrix.org). --- src/Mjolnir.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Mjolnir.ts b/src/Mjolnir.ts index 227125f..304242c 100644 --- a/src/Mjolnir.ts +++ b/src/Mjolnir.ts @@ -291,8 +291,10 @@ export class Mjolnir { await this.protectedRoomsConfig.loadProtectedRoomsFromConfig(this.config); await this.protectedRoomsConfig.loadProtectedRoomsFromAccountData(); this.protectedRoomsConfig.getExplicitlyProtectedRooms().forEach(this.protectRoom, this); - await this.resyncJoinedRooms(false); + // We have to build the policy lists before calling `resyncJoinedRooms` otherwise mjolnir will try to protect + // every policy list we are already joined to, as mjolnir will not be able to distinguish them from normal rooms. await this.buildWatchedPolicyLists(); + await this.resyncJoinedRooms(false); await this.protectionManager.start(); if (this.config.verifyPermissionsOnStartup) {