mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 01:36:06 -04:00
Merge remote-tracking branch 'origin/main' into hs/mention-spam-protection
This commit is contained in:
commit
768947529b
@ -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}`);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ export class ProtectionManager {
|
|||||||
LogService.error("ProtectionManager", "Error handling protection: " + protection.name);
|
LogService.error("ProtectionManager", "Error handling protection: " + protection.name);
|
||||||
LogService.error("ProtectionManager", "Failed event: " + eventPermalink);
|
LogService.error("ProtectionManager", "Failed event: " + eventPermalink);
|
||||||
LogService.error("ProtectionManager", extractRequestError(e));
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user