diff --git a/.gitignore b/.gitignore index 68e477ce..980d78ee 100644 --- a/.gitignore +++ b/.gitignore @@ -73,5 +73,5 @@ typings/ # Python packing directories. mjolnir.egg-info/ -# VS +# Visual Studio data .vs diff --git a/src/Mjolnir.ts b/src/Mjolnir.ts index 29f0b8c8..0d4fcdd9 100644 --- a/src/Mjolnir.ts +++ b/src/Mjolnir.ts @@ -253,7 +253,7 @@ export class Mjolnir { // Setup Web APIs console.log("Creating Web APIs"); const reportManager = new ReportManager(this); - reportManager.on("report.new", this.handleReport); + reportManager.on("report.new", this.handleReport.bind(this)); this.webapis = new WebAPIs(reportManager, this.ruleServer); // Setup join/leave listener @@ -1158,9 +1158,9 @@ export class Mjolnir { return await this.eventRedactionQueue.process(this, roomId); } - private async handleReport(roomId: string, reporterId: string, event: any, reason?: string) { + private async handleReport(e: { roomId: string, reporterId: string, event: any, reason?: string }) { for (const protection of this.enabledProtections) { - await protection.handleReport(this, roomId, reporterId, event, reason); + await protection.handleReport(this, e.roomId, e.reporterId, e.event, e.reason); } } } diff --git a/src/protections/IProtection.ts b/src/protections/IProtection.ts index b8d41cd9..f8353bd9 100644 --- a/src/protections/IProtection.ts +++ b/src/protections/IProtection.ts @@ -39,7 +39,7 @@ export abstract class Protection { } /* - * Handle a single reported event from a protecte room, to decide if we + * Handle a single reported event from a protected room, to decide if we * need to respond to it */ async handleReport(mjolnir: Mjolnir, roomId: string, reporterId: string, event: any, reason?: string): Promise {