From 505390b5ff383b02794f7c3ddacbd041cb5e0e01 Mon Sep 17 00:00:00 2001 From: Capypara Date: Fri, 1 Jul 2022 13:13:56 +0200 Subject: [PATCH 1/2] Option to disable reply pings --- config/config.sample.yaml | 2 ++ config/config.schema.yaml | 2 ++ src/config.ts | 1 + src/matrixeventprocessor.ts | 4 ++-- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/config.sample.yaml b/config/config.sample.yaml index 3443e4af..8f5a85ab 100644 --- a/config/config.sample.yaml +++ b/config/config.sample.yaml @@ -38,6 +38,8 @@ bridge: disableInviteNotifications: false # Disable Room Topic echos from matrix disableRoomTopicNotifications: false + # Disable pinging Discord users on replies in Matrix + disableDiscordReplyPings: false # Auto-determine the language of code blocks (this can be CPU-intensive) determineCodeLanguage: false # MXID of an admin user that will be PMd if the bridge experiences problems. Optional diff --git a/config/config.schema.yaml b/config/config.schema.yaml index eb320ac0..9ac4f718 100644 --- a/config/config.schema.yaml +++ b/config/config.schema.yaml @@ -32,6 +32,8 @@ properties: type: "boolean" disableRoomTopicNotifications: type: "boolean" + disableDiscordReplyPings: + type: "boolean" userActivity: type: "object" required: ["minUserActiveDays", "inactiveAfterDays"] diff --git a/src/config.ts b/src/config.ts index b9362fa9..6dfe0de6 100644 --- a/src/config.ts +++ b/src/config.ts @@ -98,6 +98,7 @@ export class DiscordBridgeConfigBridge { public disableJoinLeaveNotifications: boolean = false; public disableInviteNotifications: boolean = false; public disableRoomTopicNotifications: boolean = false; + public disableDiscordReplyPings: boolean = false; public determineCodeLanguage: boolean = false; public activityTracker: UserActivityTrackerConfig = UserActivityTrackerConfig.DEFAULT; public userLimit: number|null = null; diff --git a/src/matrixeventprocessor.ts b/src/matrixeventprocessor.ts index f1f46115..6c3e68e8 100644 --- a/src/matrixeventprocessor.ts +++ b/src/matrixeventprocessor.ts @@ -393,8 +393,8 @@ export class MatrixEventProcessor { } const replyEmbed = (await this.EventToEmbed(sourceEvent, channel, true)).messageEmbed; - // if we reply to a discord member, ping them! - if (this.bridge.isNamespacedUser(sourceEvent.sender)) { + // if we reply to a discord member and pinging is enabled, ping them! + if (this.bridge.isNamespacedUser(sourceEvent.sender) && !this.config.bridge.disableDiscordReplyPings) { const uid = this.bridge.getSuffixForUserId(sourceEvent.sender); replyEmbed.addField("ping", `<@${uid}>`); } From 41cf32723c2c34cc30203e90cbe9bb75fe95d1cc Mon Sep 17 00:00:00 2001 From: Miepee Date: Mon, 19 Sep 2022 14:51:25 +0200 Subject: [PATCH 2/2] Add feature file Signed-off-by: Jan Bidler --- changelog.d/850.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/850.feature diff --git a/changelog.d/850.feature b/changelog.d/850.feature new file mode 100644 index 00000000..09faa4e1 --- /dev/null +++ b/changelog.d/850.feature @@ -0,0 +1 @@ +Add a new option to disable pinging users on Discord when replying to them on Matrix.