summary refs log tree commit diff
path: root/rust/src/push/mod.rs
diff options
context:
space:
mode:
authorTravis Ralston <travisr@matrix.org>2022-11-28 16:29:53 -0700
committerGitHub <noreply@github.com>2022-11-28 16:29:53 -0700
commit3da645032722fbf09c1e5efbc51d8c5c78d8a2cd (patch)
tree9829bf818b0b6fd0925c6edf003f3d1d1d59bf80 /rust/src/push/mod.rs
parentMove MSC3030 `/timestamp_to_event` endpoint to stable v1 location (#14471) (diff)
downloadsynapse-3da645032722fbf09c1e5efbc51d8c5c78d8a2cd.tar.xz
Initial support for MSC3931: Room version push rule feature flags (#14520)
* Add support for MSC3931: Room Version Supports push rule condition

* Create experimental flag for future work, and use it to gate MSC3931

* Changelog entry
Diffstat (limited to 'rust/src/push/mod.rs')
-rw-r--r--rust/src/push/mod.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/rust/src/push/mod.rs b/rust/src/push/mod.rs

index d57800aa4a..eef39f6472 100644 --- a/rust/src/push/mod.rs +++ b/rust/src/push/mod.rs
@@ -277,6 +277,10 @@ pub enum KnownCondition { SenderNotificationPermission { key: Cow<'static, str>, }, + #[serde(rename = "org.matrix.msc3931.room_version_supports")] + RoomVersionSupports { + feature: Cow<'static, str>, + }, } impl IntoPy<PyObject> for Condition { @@ -492,6 +496,18 @@ fn test_deserialize_unstable_msc3664_condition() { } #[test] +fn test_deserialize_unstable_msc3931_condition() { + let json = + r#"{"kind":"org.matrix.msc3931.room_version_supports","feature":"org.example.feature"}"#; + + let condition: Condition = serde_json::from_str(json).unwrap(); + assert!(matches!( + condition, + Condition::Known(KnownCondition::RoomVersionSupports { feature: _ }) + )); +} + +#[test] fn test_deserialize_custom_condition() { let json = r#"{"kind":"custom_tag"}"#;