push: Stabilize event_property_is
This commit is contained in:
parent
93ae0a3379
commit
b8668f863b
@ -23,7 +23,7 @@ Improvements:
|
||||
- Add `InitialStateEvent::{new, to_raw, to_raw_any}`
|
||||
- Add a convenience method to construct `RoomEncryptionEventContent` with the recommended defaults.
|
||||
- `PushCondition::EventMatch` and `FlattenedJson` now use escaped dotted paths, according to MSC3873
|
||||
- Add unstable support for `event_property_is` push condition according to MSC3758
|
||||
- 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 `FullStateEventContent::redact`
|
||||
- Add new methods for `RoomPowerLevels`:
|
||||
|
@ -42,7 +42,6 @@ unstable-msc3551 = ["unstable-msc3956"]
|
||||
unstable-msc3552 = ["unstable-msc3551"]
|
||||
unstable-msc3553 = ["unstable-msc3552"]
|
||||
unstable-msc3554 = ["unstable-msc1767"]
|
||||
unstable-msc3758 = []
|
||||
unstable-msc3927 = ["unstable-msc3551"]
|
||||
unstable-msc3931 = []
|
||||
unstable-msc3932 = ["unstable-msc3931"]
|
||||
|
@ -107,12 +107,10 @@ pub enum PushCondition {
|
||||
},
|
||||
|
||||
/// Exact value match on a property of the event.
|
||||
#[cfg(feature = "unstable-msc3758")]
|
||||
EventPropertyIs {
|
||||
/// 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.
|
||||
@ -202,7 +200,6 @@ impl PushCondition {
|
||||
}
|
||||
RoomVersionFeature::_Custom(_) => false,
|
||||
},
|
||||
#[cfg(feature = "unstable-msc3758")]
|
||||
Self::EventPropertyIs { key, value } => event.get(key).map_or(false, |v| v == value),
|
||||
#[cfg(feature = "unstable-msc3966")]
|
||||
Self::EventPropertyContains { key, value } => event
|
||||
@ -805,7 +802,6 @@ mod tests {
|
||||
assert!(!room_version_condition.applies(&simple_event, &context_not_matching));
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable-msc3758")]
|
||||
#[test]
|
||||
fn event_property_is_applies() {
|
||||
use crate::push::condition::ScalarJsonValue;
|
||||
|
@ -5,9 +5,7 @@ use crate::serde::from_raw_json_value;
|
||||
|
||||
#[cfg(feature = "unstable-msc3931")]
|
||||
use super::RoomVersionFeature;
|
||||
#[cfg(any(feature = "unstable-msc3758", feature = "unstable-msc3966"))]
|
||||
use super::ScalarJsonValue;
|
||||
use super::{PushCondition, RoomMemberCountIs};
|
||||
use super::{PushCondition, RoomMemberCountIs, ScalarJsonValue};
|
||||
|
||||
impl Serialize for PushCondition {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
@ -33,7 +31,8 @@ impl<'de> Deserialize<'de> for PushCondition {
|
||||
"event_match"
|
||||
| "contains_display_name"
|
||||
| "room_member_count"
|
||||
| "sender_notification_permission" => {
|
||||
| "sender_notification_permission"
|
||||
| "event_property_is" => {
|
||||
let helper: PushConditionSerDeHelper = from_raw_json_value(&json)?;
|
||||
Ok(helper.into())
|
||||
}
|
||||
@ -42,11 +41,6 @@ impl<'de> Deserialize<'de> for PushCondition {
|
||||
let helper: PushConditionSerDeHelper = from_raw_json_value(&json)?;
|
||||
Ok(helper.into())
|
||||
}
|
||||
#[cfg(feature = "unstable-msc3758")]
|
||||
"com.beeper.msc3758.exact_event_match" => {
|
||||
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)?;
|
||||
@ -106,13 +100,17 @@ enum PushConditionSerDeHelper {
|
||||
feature: RoomVersionFeature,
|
||||
},
|
||||
|
||||
#[cfg(feature = "unstable-msc3758")]
|
||||
#[serde(rename = "com.beeper.msc3758.exact_event_match")]
|
||||
EventPropertyIs { key: String, value: ScalarJsonValue },
|
||||
EventPropertyIs {
|
||||
key: String,
|
||||
value: ScalarJsonValue,
|
||||
},
|
||||
|
||||
#[cfg(feature = "unstable-msc3966")]
|
||||
#[serde(rename = "org.matrix.msc3966.exact_event_property_contains")]
|
||||
EventPropertyContains { key: String, value: ScalarJsonValue },
|
||||
EventPropertyContains {
|
||||
key: String,
|
||||
value: ScalarJsonValue,
|
||||
},
|
||||
}
|
||||
|
||||
impl From<PushConditionSerDeHelper> for PushCondition {
|
||||
@ -130,7 +128,6 @@ impl From<PushConditionSerDeHelper> for PushCondition {
|
||||
PushConditionSerDeHelper::RoomVersionSupports { feature } => {
|
||||
Self::RoomVersionSupports { feature }
|
||||
}
|
||||
#[cfg(feature = "unstable-msc3758")]
|
||||
PushConditionSerDeHelper::EventPropertyIs { key, value } => {
|
||||
Self::EventPropertyIs { key, value }
|
||||
}
|
||||
@ -153,7 +150,6 @@ impl From<PushCondition> for PushConditionSerDeHelper {
|
||||
}
|
||||
#[cfg(feature = "unstable-msc3931")]
|
||||
PushCondition::RoomVersionSupports { feature } => Self::RoomVersionSupports { feature },
|
||||
#[cfg(feature = "unstable-msc3758")]
|
||||
PushCondition::EventPropertyIs { key, value } => Self::EventPropertyIs { key, value },
|
||||
#[cfg(feature = "unstable-msc3966")]
|
||||
PushCondition::EventPropertyContains { key, value } => {
|
||||
|
@ -181,7 +181,6 @@ unstable-msc3554 = ["ruma-common/unstable-msc3554"]
|
||||
unstable-msc3575 = ["ruma-client-api?/unstable-msc3575"]
|
||||
unstable-msc3618 = ["ruma-federation-api?/unstable-msc3618"]
|
||||
unstable-msc3723 = ["ruma-federation-api?/unstable-msc3723"]
|
||||
unstable-msc3758 = ["ruma-common/unstable-msc3758"]
|
||||
unstable-msc3927 = ["ruma-common/unstable-msc3927"]
|
||||
unstable-msc3931 = ["ruma-common/unstable-msc3931"]
|
||||
unstable-msc3932 = ["ruma-common/unstable-msc3932"]
|
||||
@ -226,7 +225,6 @@ __ci = [
|
||||
"unstable-msc3575",
|
||||
"unstable-msc3618",
|
||||
"unstable-msc3723",
|
||||
"unstable-msc3758",
|
||||
"unstable-msc3927",
|
||||
"unstable-msc3932",
|
||||
"unstable-msc3954",
|
||||
|
Loading…
x
Reference in New Issue
Block a user