diff --git a/config/default.yaml b/config/default.yaml index 66f6566..6b94fc1 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -240,3 +240,7 @@ web: # instead of intercepting client calls to synapse's abuse endpoint, when that # isn't possible/practical. pollReports: false + +# Whether or not new reports, received either by webapi or polling, +# should be printed to our managementRoom. +displayReports: true diff --git a/src/config.ts b/src/config.ts index dab6a47..c286f51 100644 --- a/src/config.ts +++ b/src/config.ts @@ -54,6 +54,11 @@ interface IConfig { */ backgroundDelayMS: number; pollReports: boolean; + /** + * Whether or not new reports, received either by webapi or polling, + * should be printed to our managementRoom. + */ + displayReports: boolean; admin?: { enableMakeRoomAdminCommand?: boolean; } @@ -124,6 +129,7 @@ const defaultConfig: IConfig = { protectAllJoinedRooms: false, backgroundDelayMS: 500, pollReports: false, + displayReports: true, commands: { allowNoPrefix: false, additionalPrefixes: [], diff --git a/src/report/ReportManager.ts b/src/report/ReportManager.ts index af64043..5c96d98 100644 --- a/src/report/ReportManager.ts +++ b/src/report/ReportManager.ts @@ -21,6 +21,7 @@ import { htmlEscape } from "../utils"; import { JSDOM } from 'jsdom'; import { EventEmitter } from 'events'; +import config from "../config"; import { Mjolnir } from "../Mjolnir"; /// Regexp, used to extract the action label from an action reaction @@ -114,7 +115,9 @@ export class ReportManager extends EventEmitter { */ public async handleServerAbuseReport({ roomId, reporterId, event, reason }: { roomId: string, reporterId: string, event: any, reason?: string }) { this.emit("report.new", { roomId: roomId, reporterId: reporterId, event: event, reason: reason }); - return this.displayManager.displayReportAndUI({ kind: Kind.SERVER_ABUSE_REPORT, event, reporterId, reason, moderationRoomId: this.mjolnir.managementRoomId }); + if (config.displayReports) { + return this.displayManager.displayReportAndUI({ kind: Kind.SERVER_ABUSE_REPORT, event, reporterId, reason, moderationRoomId: this.mjolnir.managementRoomId }); + } } /**