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).
This commit is contained in:
Gnuxie 2022-11-22 15:34:50 +00:00 committed by GitHub
parent 0845636d39
commit 410ceebd62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {