mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-07-01 00:51:36 +00:00
some documentation
This commit is contained in:
parent
1eebbc77cf
commit
f8a1c80fd2
|
@ -28,7 +28,15 @@ export interface IProtection {
|
||||||
readonly description: string;
|
readonly description: string;
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
settings: { [setting: string]: AbstractProtectionSetting<any, any> };
|
settings: { [setting: string]: AbstractProtectionSetting<any, any> };
|
||||||
|
/*
|
||||||
|
* Handle a single event from a protected room, to decide if we need to
|
||||||
|
* respond to it
|
||||||
|
*/
|
||||||
handleEvent(mjolnir: Mjolnir, roomId: string, event: any): Promise<any>;
|
handleEvent(mjolnir: Mjolnir, roomId: string, event: any): Promise<any>;
|
||||||
|
/*
|
||||||
|
* Handle a single reported event from a protecte room, to decide if we
|
||||||
|
* need to respond to it
|
||||||
|
*/
|
||||||
handleReport(mjolnir: Mjolnir, roomId: string, reporterId: string, reason: string, event: any): Promise<any>;
|
handleReport(mjolnir: Mjolnir, roomId: string, reporterId: string, reason: string, event: any): Promise<any>;
|
||||||
}
|
}
|
||||||
export abstract class Protection implements IProtection {
|
export abstract class Protection implements IProtection {
|
||||||
|
|
|
@ -21,6 +21,10 @@ import { Mjolnir } from "../Mjolnir";
|
||||||
|
|
||||||
const MAX_REPORTED_EVENT_BACKLOG = 20;
|
const MAX_REPORTED_EVENT_BACKLOG = 20;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hold a list of users trusted to make reports, and enact consequences on
|
||||||
|
* events that surpass configured report count thresholds
|
||||||
|
*/
|
||||||
export class TrustedReporters extends Protection {
|
export class TrustedReporters extends Protection {
|
||||||
private recentReported = new Map<string /* eventId */, Set<string /* reporterId */>>();
|
private recentReported = new Map<string /* eventId */, Set<string /* reporterId */>>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user