Skip to content

Commit b03d81d

Browse files
authored
ability to disable displaying new reports in moderation room (#320)
1 parent 84ffb36 commit b03d81d

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

config/default.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,7 @@ web:
240240
# instead of intercepting client calls to synapse's abuse endpoint, when that
241241
# isn't possible/practical.
242242
pollReports: false
243+
244+
# Whether or not new reports, received either by webapi or polling,
245+
# should be printed to our managementRoom.
246+
displayReports: true

src/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ interface IConfig {
5454
*/
5555
backgroundDelayMS: number;
5656
pollReports: boolean;
57+
/**
58+
* Whether or not new reports, received either by webapi or polling,
59+
* should be printed to our managementRoom.
60+
*/
61+
displayReports: boolean;
5762
admin?: {
5863
enableMakeRoomAdminCommand?: boolean;
5964
}
@@ -124,6 +129,7 @@ const defaultConfig: IConfig = {
124129
protectAllJoinedRooms: false,
125130
backgroundDelayMS: 500,
126131
pollReports: false,
132+
displayReports: true,
127133
commands: {
128134
allowNoPrefix: false,
129135
additionalPrefixes: [],

src/report/ReportManager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { htmlEscape } from "../utils";
2121
import { JSDOM } from 'jsdom';
2222
import { EventEmitter } from 'events';
2323

24+
import config from "../config";
2425
import { Mjolnir } from "../Mjolnir";
2526

2627
/// Regexp, used to extract the action label from an action reaction
@@ -114,7 +115,9 @@ export class ReportManager extends EventEmitter {
114115
*/
115116
public async handleServerAbuseReport({ roomId, reporterId, event, reason }: { roomId: string, reporterId: string, event: any, reason?: string }) {
116117
this.emit("report.new", { roomId: roomId, reporterId: reporterId, event: event, reason: reason });
117-
return this.displayManager.displayReportAndUI({ kind: Kind.SERVER_ABUSE_REPORT, event, reporterId, reason, moderationRoomId: this.mjolnir.managementRoomId });
118+
if (config.displayReports) {
119+
return this.displayManager.displayReportAndUI({ kind: Kind.SERVER_ABUSE_REPORT, event, reporterId, reason, moderationRoomId: this.mjolnir.managementRoomId });
120+
}
118121
}
119122

120123
/**

0 commit comments

Comments
 (0)