From fe9f9a81f01b3e9e2fd90dfac0976be210a63df9 Mon Sep 17 00:00:00 2001 From: hanadi92 Date: Wed, 8 May 2024 18:32:38 +0300 Subject: [PATCH] fix: update msc number --- changelog.d/16858.feature | 2 +- rust/src/push/evaluator.rs | 12 ++++++------ rust/src/push/mod.rs | 4 ++-- synapse/config/experimental.py | 6 +++--- synapse/push/bulk_push_rule_evaluator.py | 2 +- synapse/synapse_rust/push.pyi | 2 +- tests/push/test_push_rule_evaluator.py | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/changelog.d/16858.feature b/changelog.d/16858.feature index 260e5f7576..616ac4cc05 100644 --- a/changelog.d/16858.feature +++ b/changelog.d/16858.feature @@ -1 +1 @@ -Experimental support for [MSC3767](https://github.com/matrix-org/matrix-spec-proposals/pull/3767): the `time_and_day` push rule condition. Contributed by @hanadi92. \ No newline at end of file +Experimental support for [MSC4141](https://github.com/matrix-org/matrix-spec-proposals/pull/4141): the `time_and_day` push rule condition. Contributed by @hanadi92. \ No newline at end of file diff --git a/rust/src/push/evaluator.rs b/rust/src/push/evaluator.rs index 6ab28d60c6..bc2bf427f9 100644 --- a/rust/src/push/evaluator.rs +++ b/rust/src/push/evaluator.rs @@ -107,8 +107,8 @@ pub struct PushRuleEvaluator { /// flag as MSC1767 (extensible events core). msc3931_enabled: bool, - /// If MSC3767 (time based notification filtering push rule condition) is enabled - msc3767_time_and_day: bool, + /// If MSC4141 (time based notification filtering push rule condition) is enabled + msc4141_time_and_day: bool, } #[pymethods] @@ -126,7 +126,7 @@ impl PushRuleEvaluator { related_event_match_enabled, room_version_feature_flags, msc3931_enabled, - msc3767_time_and_day, + msc4141_time_and_day, ))] pub fn py_new( flattened_keys: BTreeMap, @@ -138,7 +138,7 @@ impl PushRuleEvaluator { related_event_match_enabled: bool, room_version_feature_flags: Vec, msc3931_enabled: bool, - msc3767_time_and_day: bool, + msc4141_time_and_day: bool, ) -> Result { let body = match flattened_keys.get("content.body") { Some(JsonValue::Value(SimpleJsonValue::Str(s))) => s.clone().into_owned(), @@ -156,7 +156,7 @@ impl PushRuleEvaluator { related_event_match_enabled, room_version_feature_flags, msc3931_enabled, - msc3767_time_and_day, + msc4141_time_and_day, }) } @@ -392,7 +392,7 @@ impl PushRuleEvaluator { } } KnownCondition::TimeAndDay(time_and_day) => { - if !self.msc3767_time_and_day { + if !self.msc4141_time_and_day { false } else { self.match_time_and_day(time_and_day.timezone, &time_and_day.intervals)? diff --git a/rust/src/push/mod.rs b/rust/src/push/mod.rs index d32b766b4b..3d5259ad2d 100644 --- a/rust/src/push/mod.rs +++ b/rust/src/push/mod.rs @@ -362,7 +362,7 @@ pub enum KnownCondition { RoomVersionSupports { feature: Cow<'static, str>, }, - #[serde(rename = "org.matrix.msc3767.time_and_day")] + #[serde(rename = "org.matrix.msc4141.time_and_day")] TimeAndDay(TimeAndDayCondition), } @@ -455,7 +455,7 @@ pub struct TimeAndDayCondition { pub struct TimeAndDayIntervals { /// Tuple of hh::mm representing start and end times of the day pub time_of_day: Option, - /// 0 = Sunday, 1 = Monday, ..., 7 = Sunday + /// 0 = Sunday, 1 = Monday, ..., 6 = Saturday pub day_of_week: Vec, } diff --git a/synapse/config/experimental.py b/synapse/config/experimental.py index 403a2119de..cf85dfe7f8 100644 --- a/synapse/config/experimental.py +++ b/synapse/config/experimental.py @@ -437,7 +437,7 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None: "msc4115_membership_on_events", False ) - # MSC3767: time based notification filtering - self.msc3767_time_and_day = experimental.get( - "org.matrix.msc3767.time_and_day", False + # MSC4141: time based notification filtering + self.msc4141_time_and_day = experimental.get( + "org.matrix.msc4141.time_and_day", False ) diff --git a/synapse/push/bulk_push_rule_evaluator.py b/synapse/push/bulk_push_rule_evaluator.py index 3fc1a4f59b..865d05a894 100644 --- a/synapse/push/bulk_push_rule_evaluator.py +++ b/synapse/push/bulk_push_rule_evaluator.py @@ -435,7 +435,7 @@ async def _action_for_event_by_user( self._related_event_match_enabled, event.room_version.msc3931_push_features, self.hs.config.experimental.msc1767_enabled, # MSC3931 flag - self.hs.config.experimental.msc3767_time_and_day, + self.hs.config.experimental.msc4141_time_and_day, ) for uid, rules in rules_by_user.items(): diff --git a/synapse/synapse_rust/push.pyi b/synapse/synapse_rust/push.pyi index ba38ab0b35..2e557489ba 100644 --- a/synapse/synapse_rust/push.pyi +++ b/synapse/synapse_rust/push.pyi @@ -65,7 +65,7 @@ class PushRuleEvaluator: related_event_match_enabled: bool, room_version_feature_flags: Tuple[str, ...], msc3931_enabled: bool, - msc3767_time_and_day: bool, + msc4141_time_and_day: bool, ): ... def run( self, diff --git a/tests/push/test_push_rule_evaluator.py b/tests/push/test_push_rule_evaluator.py index e330ac395a..63408dfa1f 100644 --- a/tests/push/test_push_rule_evaluator.py +++ b/tests/push/test_push_rule_evaluator.py @@ -174,7 +174,7 @@ def _get_evaluator( related_event_match_enabled=True, room_version_feature_flags=event.room_version.msc3931_push_features, msc3931_enabled=True, - msc3767_time_and_day=True, + msc4141_time_and_day=True, ) def test_display_name(self) -> None: @@ -806,7 +806,7 @@ def test_related_event_match_no_related_event(self) -> None: def test_time_and_day_match(self) -> None: # for testing, make whole day in do not disturb condition = { - "kind": "org.matrix.msc3767.time_and_day", + "kind": "org.matrix.msc4141.time_and_day", "timezone": None, "intervals": [ {