@@ -23,7 +23,7 @@ use regex::Regex;
2323
2424use super :: {
2525 utils:: { get_glob_matcher, get_localpart_from_id, GlobMatchType } ,
26- Action , Condition , ExactEventMatchCondition , FilteredPushRules , KnownCondition ,
26+ Action , Condition , EventPropertyIsCondition , FilteredPushRules , KnownCondition ,
2727 SimpleJsonValue ,
2828} ;
2929use crate :: push:: { EventMatchPatternType , JsonValue } ;
@@ -97,9 +97,6 @@ pub struct PushRuleEvaluator {
9797 /// flag as MSC1767 (extensible events core).
9898 msc3931_enabled : bool ,
9999
100- /// If MSC3758 (exact_event_match push rule condition) is enabled.
101- msc3758_exact_event_match : bool ,
102-
103100 /// If MSC3966 (exact_event_property_contains push rule condition) is enabled.
104101 msc3966_exact_event_property_contains : bool ,
105102}
@@ -119,7 +116,6 @@ impl PushRuleEvaluator {
119116 related_event_match_enabled : bool ,
120117 room_version_feature_flags : Vec < String > ,
121118 msc3931_enabled : bool ,
122- msc3758_exact_event_match : bool ,
123119 msc3966_exact_event_property_contains : bool ,
124120 ) -> Result < Self , Error > {
125121 let body = match flattened_keys. get ( "content.body" ) {
@@ -138,7 +134,6 @@ impl PushRuleEvaluator {
138134 related_event_match_enabled,
139135 room_version_feature_flags,
140136 msc3931_enabled,
141- msc3758_exact_event_match,
142137 msc3966_exact_event_property_contains,
143138 } )
144139 }
@@ -275,8 +270,8 @@ impl PushRuleEvaluator {
275270
276271 self . match_event_match ( & self . flattened_keys , & event_match. key , pattern) ?
277272 }
278- KnownCondition :: ExactEventMatch ( exact_event_match ) => {
279- self . match_exact_event_match ( exact_event_match ) ?
273+ KnownCondition :: EventPropertyIs ( event_property_is ) => {
274+ self . match_event_property_is ( event_property_is ) ?
280275 }
281276 KnownCondition :: RelatedEventMatch ( event_match) => self . match_related_event_match (
282277 & event_match. rel_type . clone ( ) ,
@@ -306,10 +301,10 @@ impl PushRuleEvaluator {
306301 Some ( Cow :: Borrowed ( pattern) ) ,
307302 ) ?
308303 }
309- KnownCondition :: ExactEventPropertyContains ( exact_event_match ) => self
304+ KnownCondition :: ExactEventPropertyContains ( event_property_is ) => self
310305 . match_exact_event_property_contains (
311- exact_event_match . key . clone ( ) ,
312- exact_event_match . value . clone ( ) ,
306+ event_property_is . key . clone ( ) ,
307+ event_property_is . value . clone ( ) ,
313308 ) ?,
314309 KnownCondition :: ExactEventPropertyContainsType ( exact_event_match) => {
315310 // The `pattern_type` can either be "user_id" or "user_localpart",
@@ -405,20 +400,15 @@ impl PushRuleEvaluator {
405400 compiled_pattern. is_match ( haystack)
406401 }
407402
408- /// Evaluates a `exact_event_match ` condition. (MSC3758)
409- fn match_exact_event_match (
403+ /// Evaluates a `event_property_is ` condition.
404+ fn match_event_property_is (
410405 & self ,
411- exact_event_match : & ExactEventMatchCondition ,
406+ event_property_is : & EventPropertyIsCondition ,
412407 ) -> Result < bool , Error > {
413- // First check if the feature is enabled.
414- if !self . msc3758_exact_event_match {
415- return Ok ( false ) ;
416- }
417-
418- let value = & exact_event_match. value ;
408+ let value = & event_property_is. value ;
419409
420410 let haystack = if let Some ( JsonValue :: Value ( haystack) ) =
421- self . flattened_keys . get ( & * exact_event_match . key )
411+ self . flattened_keys . get ( & * event_property_is . key )
422412 {
423413 haystack
424414 } else {
@@ -464,7 +454,7 @@ impl PushRuleEvaluator {
464454 }
465455 }
466456
467- /// Evaluates a `exact_event_property_contains` condition. (MSC3758 )
457+ /// Evaluates a `exact_event_property_contains` condition. (MSC3966 )
468458 fn match_exact_event_property_contains (
469459 & self ,
470460 key : Cow < str > ,
@@ -526,7 +516,6 @@ fn push_rule_evaluator() {
526516 vec ! [ ] ,
527517 true ,
528518 true ,
529- true ,
530519 )
531520 . unwrap ( ) ;
532521
@@ -557,7 +546,6 @@ fn test_requires_room_version_supports_condition() {
557546 flags,
558547 true ,
559548 true ,
560- true ,
561549 )
562550 . unwrap ( ) ;
563551
0 commit comments