push: Stabilize event_property_contains
This commit is contained in:
parent
b8668f863b
commit
0bec1ad507
@ -24,7 +24,7 @@ Improvements:
|
||||
- Add a convenience method to construct `RoomEncryptionEventContent` with the recommended defaults.
|
||||
- `PushCondition::EventMatch` and `FlattenedJson` now use escaped dotted paths, according to MSC3873
|
||||
- Add support for `event_property_is` push condition (MSC3758 / Matrix 1.7)
|
||||
- Add unstable support for `event_property_contains` push condition according to MSC3966
|
||||
- Add support for `event_property_contains` push condition (MSC3966 / Matrix 1.7)
|
||||
- Add `FullStateEventContent::redact`
|
||||
- Add new methods for `RoomPowerLevels`:
|
||||
- `user_can_ban`
|
||||
|
@ -48,7 +48,6 @@ unstable-msc3932 = ["unstable-msc3931"]
|
||||
unstable-msc3954 = ["unstable-msc1767"]
|
||||
unstable-msc3955 = ["unstable-msc1767"]
|
||||
unstable-msc3956 = ["unstable-msc1767"]
|
||||
unstable-msc3966 = []
|
||||
unstable-pdu = []
|
||||
unstable-sanitize = ["dep:html5ever", "dep:phf"]
|
||||
unstable-unspecified = []
|
||||
|
@ -118,12 +118,10 @@ pub enum PushCondition {
|
||||
},
|
||||
|
||||
/// Exact value match on a value in an array property of the event.
|
||||
#[cfg(feature = "unstable-msc3966")]
|
||||
EventPropertyContains {
|
||||
/// The dot-separated path of the property of the event to match. See [MSC3873] for its
|
||||
/// format.
|
||||
/// The [dot-separated path] of the property of the event to match.
|
||||
///
|
||||
/// [MSC3873]: https://github.com/matrix-org/matrix-spec-proposals/pull/3873
|
||||
/// [dot-separated path]: https://spec.matrix.org/latest/appendices/#dot-separated-property-paths
|
||||
key: String,
|
||||
|
||||
/// The value to match against.
|
||||
@ -201,7 +199,6 @@ impl PushCondition {
|
||||
RoomVersionFeature::_Custom(_) => false,
|
||||
},
|
||||
Self::EventPropertyIs { key, value } => event.get(key).map_or(false, |v| v == value),
|
||||
#[cfg(feature = "unstable-msc3966")]
|
||||
Self::EventPropertyContains { key, value } => event
|
||||
.get(key)
|
||||
.and_then(FlattenedJsonValue::as_array)
|
||||
@ -867,7 +864,6 @@ mod tests {
|
||||
assert!(null_match.applies(&event, &context));
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable-msc3966")]
|
||||
#[test]
|
||||
fn event_property_contains_applies() {
|
||||
use crate::push::condition::ScalarJsonValue;
|
||||
|
@ -32,7 +32,8 @@ impl<'de> Deserialize<'de> for PushCondition {
|
||||
| "contains_display_name"
|
||||
| "room_member_count"
|
||||
| "sender_notification_permission"
|
||||
| "event_property_is" => {
|
||||
| "event_property_is"
|
||||
| "event_property_contains" => {
|
||||
let helper: PushConditionSerDeHelper = from_raw_json_value(&json)?;
|
||||
Ok(helper.into())
|
||||
}
|
||||
@ -41,11 +42,6 @@ impl<'de> Deserialize<'de> for PushCondition {
|
||||
let helper: PushConditionSerDeHelper = from_raw_json_value(&json)?;
|
||||
Ok(helper.into())
|
||||
}
|
||||
#[cfg(feature = "unstable-msc3966")]
|
||||
"org.matrix.msc3966.exact_event_property_contains" => {
|
||||
let helper: PushConditionSerDeHelper = from_raw_json_value(&json)?;
|
||||
Ok(helper.into())
|
||||
}
|
||||
_ => from_raw_json_value(&json).map(Self::_Custom),
|
||||
}
|
||||
}
|
||||
@ -105,8 +101,6 @@ enum PushConditionSerDeHelper {
|
||||
value: ScalarJsonValue,
|
||||
},
|
||||
|
||||
#[cfg(feature = "unstable-msc3966")]
|
||||
#[serde(rename = "org.matrix.msc3966.exact_event_property_contains")]
|
||||
EventPropertyContains {
|
||||
key: String,
|
||||
value: ScalarJsonValue,
|
||||
@ -131,7 +125,6 @@ impl From<PushConditionSerDeHelper> for PushCondition {
|
||||
PushConditionSerDeHelper::EventPropertyIs { key, value } => {
|
||||
Self::EventPropertyIs { key, value }
|
||||
}
|
||||
#[cfg(feature = "unstable-msc3966")]
|
||||
PushConditionSerDeHelper::EventPropertyContains { key, value } => {
|
||||
Self::EventPropertyContains { key, value }
|
||||
}
|
||||
@ -151,7 +144,6 @@ impl From<PushCondition> for PushConditionSerDeHelper {
|
||||
#[cfg(feature = "unstable-msc3931")]
|
||||
PushCondition::RoomVersionSupports { feature } => Self::RoomVersionSupports { feature },
|
||||
PushCondition::EventPropertyIs { key, value } => Self::EventPropertyIs { key, value },
|
||||
#[cfg(feature = "unstable-msc3966")]
|
||||
PushCondition::EventPropertyContains { key, value } => {
|
||||
Self::EventPropertyContains { key, value }
|
||||
}
|
||||
|
@ -187,7 +187,6 @@ unstable-msc3932 = ["ruma-common/unstable-msc3932"]
|
||||
unstable-msc3954 = ["ruma-common/unstable-msc3954"]
|
||||
unstable-msc3955 = ["ruma-common/unstable-msc3955"]
|
||||
unstable-msc3956 = ["ruma-common/unstable-msc3956"]
|
||||
unstable-msc3966 = ["ruma-common/unstable-msc3966"]
|
||||
unstable-pdu = ["ruma-common/unstable-pdu"]
|
||||
unstable-sanitize = ["ruma-common/unstable-sanitize"]
|
||||
unstable-unspecified = [
|
||||
@ -230,7 +229,6 @@ __ci = [
|
||||
"unstable-msc3954",
|
||||
"unstable-msc3955",
|
||||
"unstable-msc3956",
|
||||
"unstable-msc3966",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
|
Loading…
x
Reference in New Issue
Block a user