Skip to content

Commit

Permalink
Skip legacy rule processing if mentions exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Mar 13, 2023
1 parent fe89122 commit e51bd2e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/pushprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,16 @@ export class PushProcessor {
}

public ruleMatchesEvent(rule: Partial<IPushRule> & Pick<IPushRule, "conditions">, 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));
}

Expand Down

0 comments on commit e51bd2e

Please sign in to comment.