mirror of
https://github.com/the-draupnir-project/Draupnir.git
synced 2026-10-22 17:11:17 +00:00
Stop MatrixReactionHandler reacting to itself.
This commit is contained in:
1 parent
492230d61d
commit
1fbeda0d4c
2 files changed
+9
-2
No files matched your search
+1
-1
@@ -183,7 +183,7 @@ export class Mjolnir {
|
||||
) {
|
||||
this.protectedRoomsConfig = new ProtectedRoomsConfig(client);
|
||||
this.policyListManager = new PolicyListManager(this);
|
||||
this.reactionHandler = new MatrixReactionHandler(this.managementRoomId, client);
|
||||
this.reactionHandler = new MatrixReactionHandler(this.managementRoomId, client, clientUserId);
|
||||
|
||||
const mutedModules = (LogService as any).mutedModules;
|
||||
if (!Array.isArray(mutedModules)) {
|
||||
|
||||
@@ -29,7 +29,11 @@ export class MatrixReactionHandler extends EventEmitter {
|
||||
/**
|
||||
* A client to lookup the related events to reactions.
|
||||
*/
|
||||
private readonly client: MatrixSendClient
|
||||
private readonly client: MatrixSendClient,
|
||||
/**
|
||||
* The user id of the client. Ignores reactions from this user
|
||||
*/
|
||||
private readonly clientUserId: string
|
||||
) {
|
||||
super();
|
||||
this.listener = this.handleEvent.bind(this);
|
||||
@@ -53,6 +57,9 @@ export class MatrixReactionHandler extends EventEmitter {
|
||||
if (relatesTo['rel_type'] !== 'm.annotation') {
|
||||
return;
|
||||
}
|
||||
if (event['sender'] === this.clientUserId) {
|
||||
return;
|
||||
}
|
||||
const reactionKey = relatesTo['key'];
|
||||
const relatedEventId = relatesTo['event_id'];
|
||||
if (!(typeof relatedEventId === 'string' && typeof reactionKey === 'string')) {
|
||||
|
||||
Reference in new issue
Block a user