Adopt MSC4506 identifiers for the knock push rule

The knock push rules MSC has been published as MSC4506: rename the
experimental flag to msc4506_enabled, the rule id to
.org.matrix.msc4506.rule.knock and the condition kind to
org.matrix.msc4506.recipient_permission per its unstable prefix section.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uk8aPxHn3BHCe52L226jdG
This commit is contained in:
Matthew Hodgson
2026-07-14 13:23:26 +01:00
co-authored by Claude Fable 5
parent c24038ff6f
commit 9cea90e6cc
9 changed files with 27 additions and 27 deletions
+2 -2
View File
@@ -117,12 +117,12 @@ pub const BASE_APPEND_OVERRIDE_RULES: &[PushRule] = &[
default: true,
default_enabled: true,
},
// MSCxxxx: notify the members of a room who are able to act on a knock
// MSC4506: notify the members of a room who are able to act on a knock
// (i.e. those with a power level sufficient to invite the knocker). Must
// come before `.m.rule.member_event`, which suppresses all other member
// events.
PushRule {
rule_id: Cow::Borrowed("global/override/.org.matrix.mscxxxx.rule.knock"),
rule_id: Cow::Borrowed("global/override/.org.matrix.msc4506.rule.knock"),
priority_class: 5,
conditions: Cow::Borrowed(&[
Condition::Known(KnownCondition::EventMatch(EventMatchCondition {
+2 -2
View File
@@ -92,7 +92,7 @@ pub struct PushRuleEvaluator {
/// outlier.
sender_power_level: Option<i64>,
/// MSCxxxx: the power level required to perform each of the room's
/// MSC4506: the power level required to perform each of the room's
/// power-levels actions (e.g. "invite", "kick"), for the
/// `recipient_permission` condition. Includes the spec defaults for
/// actions absent from the `m.room.power_levels` content.
@@ -190,7 +190,7 @@ impl PushRuleEvaluator {
/// - `Some(false)` if the event is in a thread and the user does NOT have a subscription for that thread
///
/// recipient_power_level: the power level of the user the rules are being
/// evaluated for, used by the MSCxxxx `recipient_permission` condition.
/// evaluated for, used by the MSC4506 `recipient_permission` condition.
#[pyo3(signature = (push_rules, user_id=None, display_name=None, msc4306_thread_subscription_state=None, recipient_power_level=None))]
pub fn run(
&self,
+7 -7
View File
@@ -369,10 +369,10 @@ pub enum KnownCondition {
SenderNotificationPermission {
key: Cow<'static, str>,
},
// MSCxxxx (knock push rules): matches if the user the rules are being
// MSC4506 (knock push rules): matches if the user the rules are being
// evaluated for has a power level at least that required to perform the
// action named by `key` (e.g. "invite").
#[serde(rename = "org.matrix.mscxxxx.recipient_permission")]
#[serde(rename = "org.matrix.msc4506.recipient_permission")]
RecipientPermission {
key: Cow<'static, str>,
},
@@ -567,7 +567,7 @@ pub struct FilteredPushRules {
msc4210_enabled: bool,
msc4306_enabled: bool,
msc4505_enabled: bool,
mscxxxx_knock_push_rule_enabled: bool,
msc4506_enabled: bool,
}
#[pymethods]
@@ -584,7 +584,7 @@ impl FilteredPushRules {
msc4210_enabled: bool,
msc4306_enabled: bool,
msc4505_enabled: bool,
mscxxxx_knock_push_rule_enabled: bool,
msc4506_enabled: bool,
) -> Self {
Self {
push_rules,
@@ -596,7 +596,7 @@ impl FilteredPushRules {
msc4210_enabled,
msc4306_enabled,
msc4505_enabled,
mscxxxx_knock_push_rule_enabled,
msc4506_enabled,
}
}
@@ -639,8 +639,8 @@ impl FilteredPushRules {
return false;
}
if !self.mscxxxx_knock_push_rule_enabled
&& rule.rule_id.contains("/.org.matrix.mscxxxx.rule.knock")
if !self.msc4506_enabled
&& rule.rule_id.contains("/.org.matrix.msc4506.rule.knock")
{
return false;
}