From 3be2da5c477bb1da33378a12b2cefba26e4206dd Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 4 Dec 2019 19:12:35 -0700 Subject: [PATCH] Automatically sync the ban lists after issuing a ban Workaround for https://github.com/matrix-org/mjolnir/issues/13. Fixes https://github.com/matrix-org/mjolnir/issues/13 --- src/commands/UnbanBanCommand.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/commands/UnbanBanCommand.ts b/src/commands/UnbanBanCommand.ts index 12d0c76b..89433254 100644 --- a/src/commands/UnbanBanCommand.ts +++ b/src/commands/UnbanBanCommand.ts @@ -119,6 +119,10 @@ export async function execBanCommand(roomId: string, event: any, mjolnir: Mjolni await mjolnir.client.sendStateEvent(bits.list.roomId, bits.ruleType, stateKey, ruleContent); await mjolnir.client.unstableApis.addReactionToEvent(roomId, event['event_id'], '✅'); + + // Just sync the lists to apply the ban as it might not always come down /sync for some reason + await logMessage(LogLevel.DEBUG, "UnbanBanCommand", `Syncing lists to ensure the ban is applied`); + await mjolnir.syncLists(config.verboseLogging); } // !mjolnir unban [apply:t/f]