From e51bd2ead7c5dc5e9c685fe3dc599fec15e8cfbb Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Wed, 1 Mar 2023 12:58:38 -0500 Subject: [PATCH] Skip legacy rule processing if mentions exist. --- src/pushprocessor.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pushprocessor.ts b/src/pushprocessor.ts index 4d85227fe82..ada7d4bb165 100644 --- a/src/pushprocessor.ts +++ b/src/pushprocessor.ts @@ -712,6 +712,16 @@ export class PushProcessor { } public ruleMatchesEvent(rule: Partial & Pick, ev: MatrixEvent): boolean { + // Disable the deprecated mentions push rules if the new mentions property exists. + if ( + ev.getContent()["org.matrix.msc3952.mentions"] !== undefined && + (rule.rule_id === RuleId.ContainsUserName || + rule.rule_id === RuleId.ContainsDisplayName || + rule.rule_id === RuleId.AtRoomNotification) + ) { + return false; + } + return !rule.conditions?.some((cond) => !this.eventFulfillsCondition(cond, ev)); }