ability to disable displaying new reports in moderation room

This commit is contained in:
jesopo 2022-07-04 17:11:31 +00:00
parent ed68e02c4e
commit ca2c8e535f
2 changed files with 6 additions and 1 deletions

View File

@ -54,6 +54,7 @@ interface IConfig {
*/
backgroundDelayMS: number;
pollReports: boolean;
displayReports: boolean;
admin?: {
enableMakeRoomAdminCommand?: boolean;
}
@ -124,6 +125,7 @@ const defaultConfig: IConfig = {
protectAllJoinedRooms: false,
backgroundDelayMS: 500,
pollReports: false,
displayReports: false,
commands: {
allowNoPrefix: false,
additionalPrefixes: [],

View File

@ -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 });
}
}
/**