mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 01:36:06 -04:00
ability to disable displaying new reports in moderation room (#320)
This commit is contained in:
parent
84ffb36494
commit
b03d81dcc4
@ -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
|
||||
|
@ -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: [],
|
||||
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user