From 35f59771a9b33010776b9fce3773e3d0918ad1d7 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Thu, 19 Sep 2024 16:06:20 +0100 Subject: [PATCH 1/2] Name the protection that failed. --- src/protections/ProtectionManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protections/ProtectionManager.ts b/src/protections/ProtectionManager.ts index 9bd1e2c..f8c2c74 100644 --- a/src/protections/ProtectionManager.ts +++ b/src/protections/ProtectionManager.ts @@ -308,7 +308,7 @@ export class ProtectionManager { LogService.error("ProtectionManager", "Error handling protection: " + protection.name); LogService.error("ProtectionManager", "Failed event: " + eventPermalink); LogService.error("ProtectionManager", extractRequestError(e)); - await this.mjolnir.client.sendNotice(this.mjolnir.managementRoomId, "There was an error processing an event through a protection - see log for details. Event: " + eventPermalink); + await this.mjolnir.client.sendNotice(this.mjolnir.managementRoomId, `There was an error processing an event through a protection (${protection.name}) - see log for details. Event: ${eventPermalink}`); continue; } From 4f73da38b893065382cf08438a8687daa570ed7d Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Thu, 19 Sep 2024 22:41:51 +0100 Subject: [PATCH 2/2] await redact in nsfw protection --- src/protections/NsfwProtection.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/protections/NsfwProtection.ts b/src/protections/NsfwProtection.ts index 040bf1c..6be229a 100644 --- a/src/protections/NsfwProtection.ts +++ b/src/protections/NsfwProtection.ts @@ -60,10 +60,9 @@ export class NsfwProtection extends Protection { if (prediction["probability"] > mjolnir.config.nsfwSensitivity) { await mjolnir.managementRoomOutput.logMessage(LogLevel.INFO, "NSFWProtection", `Redacting ${event["event_id"]} for inappropriate content.`); try { - mjolnir.client.redactEvent(roomId, event["event_id"]) + await mjolnir.client.redactEvent(roomId, event["event_id"]); } catch (err) { await mjolnir.managementRoomOutput.logMessage(LogLevel.ERROR, "NSFWProtection", `There was an error redacting ${event["event_id"]}: ${err}`); - } } }