Merge pull request #526 from matrix-org/hs/await-redact

Fix NSFW protection not awaiting redaction
This commit is contained in:
Travis Ralston 2024-09-20 00:46:28 +02:00 committed by GitHub
commit d3f8c033b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,10 +60,9 @@ export class NsfwProtection extends Protection {
if (prediction["probability"] > mjolnir.config.nsfwSensitivity) { if (prediction["probability"] > mjolnir.config.nsfwSensitivity) {
await mjolnir.managementRoomOutput.logMessage(LogLevel.INFO, "NSFWProtection", `Redacting ${event["event_id"]} for inappropriate content.`); await mjolnir.managementRoomOutput.logMessage(LogLevel.INFO, "NSFWProtection", `Redacting ${event["event_id"]} for inappropriate content.`);
try { try {
mjolnir.client.redactEvent(roomId, event["event_id"]) await mjolnir.client.redactEvent(roomId, event["event_id"]);
} catch (err) { } catch (err) {
await mjolnir.managementRoomOutput.logMessage(LogLevel.ERROR, "NSFWProtection", `There was an error redacting ${event["event_id"]}: ${err}`); await mjolnir.managementRoomOutput.logMessage(LogLevel.ERROR, "NSFWProtection", `There was an error redacting ${event["event_id"]}: ${err}`);
} }
} }
} }