push: Add push rule to ignore room server ACLs

According to MSC3786
This commit is contained in:
Kévin Commaille 2022-07-16 12:02:56 +02:00 committed by Kévin Commaille
parent c63f03912b
commit 2f96fa5548
4 changed files with 23 additions and 0 deletions

View file

@ -45,6 +45,7 @@ Improvements:
* Add methods to sanitize messages according to the spec behind the `unstable-sanitize` feature
* Can also remove rich reply fallbacks
* Implement `From<Owned*Id>` for `identifiers::matrix_uri::MatrixId`
* Add unstable default push rule to ignore room server ACLs events (MSC3786)
# 0.9.2

View file

@ -49,6 +49,7 @@ unstable-msc3551 = ["unstable-msc1767"]
unstable-msc3552 = ["unstable-msc3551"]
unstable-msc3553 = ["unstable-msc3552"]
unstable-msc3554 = ["unstable-msc1767"]
unstable-msc3786 = []
[dependencies]
base64 = "0.13.0"

View file

@ -26,6 +26,8 @@ impl Ruleset {
ConditionalPushRule::member_event(),
ConditionalPushRule::contains_display_name(),
ConditionalPushRule::tombstone(),
#[cfg(feature = "unstable-msc3786")]
ConditionalPushRule::server_acl(),
ConditionalPushRule::roomnotif(),
#[cfg(feature = "unstable-msc2677")]
ConditionalPushRule::reaction(),
@ -169,6 +171,23 @@ impl ConditionalPushRule {
conditions: vec![EventMatch { key: "type".into(), pattern: "m.reaction".into() }],
}
}
/// Matches [room server ACLs].
///
/// [room server ACLs]: https://spec.matrix.org/v1.3/client-server-api/#server-access-control-lists-acls-for-rooms
#[cfg(feature = "unstable-msc3786")]
pub fn server_acl() -> Self {
Self {
actions: vec![],
default: true,
enabled: true,
rule_id: ".org.matrix.msc3786.rule.room.server_acl".into(),
conditions: vec![
EventMatch { key: "type".into(), pattern: "m.room.server_acl".into() },
EventMatch { key: "state_key".into(), pattern: "".into() },
],
}
}
}
/// Default content push rules

View file

@ -152,6 +152,7 @@ unstable-msc3553 = ["ruma-common/unstable-msc3553"]
unstable-msc3554 = ["ruma-common/unstable-msc3554"]
unstable-msc3618 = ["ruma-federation-api?/unstable-msc3618"]
unstable-msc3723 = ["ruma-federation-api?/unstable-msc3723"]
unstable-msc3786 = ["ruma-common/unstable-msc3786"]
# Private feature, only used in test / benchmarking code
__ci = [
@ -177,6 +178,7 @@ __ci = [
"unstable-msc3554",
"unstable-msc3618",
"unstable-msc3723",
"unstable-msc3786",
]
[dependencies]