some documentation

This commit is contained in:
jesopo 2022-02-07 23:18:02 +00:00
parent 1eebbc77cf
commit f8a1c80fd2
2 changed files with 12 additions and 0 deletions

View File

@ -28,7 +28,15 @@ export interface IProtection {
readonly description: string;
enabled: boolean;
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>;
/*
* 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>;
}
export abstract class Protection implements IProtection {

View File

@ -21,6 +21,10 @@ import { Mjolnir } from "../Mjolnir";
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 {
private recentReported = new Map<string /* eventId */, Set<string /* reporterId */>>();