@@ -811,79 +811,5 @@ void main() {
811811 returnsNormally,
812812 );
813813 });
814-
815- test ('escaped dot in property key (m.mentions)' , () async {
816- // The Matrix spec uses \. to escape literal dots in property paths.
817- // e.g., content.m\.mentions.room means content["m.mentions"]["room"]
818- final event = Event .fromJson (jsonObj, room);
819-
820- // Test 1: event_property_is with escaped dot - room mention
821- event.content['m.mentions' ] = {'room' : true };
822-
823- final roomMentionRuleset = PushRuleSet (
824- override: [
825- PushRule (
826- ruleId: '.m.is_room_mention' ,
827- default$: true ,
828- enabled: true ,
829- actions: [
830- 'notify' ,
831- {'set_tweak' : 'highlight' , 'value' : true },
832- {'set_tweak' : 'sound' , 'value' : 'goose.wav' },
833- ],
834- conditions: [
835- PushCondition (
836- kind: 'event_property_is' ,
837- key: r'content.m\.mentions.room' , // escaped dot!
838- value: true ,
839- ),
840- ],
841- ),
842- ],
843- );
844-
845- var evaluator = PushruleEvaluator .fromRuleset (roomMentionRuleset);
846- var actions = evaluator.match (event);
847- expect (actions.notify, true , reason: 'room mention should match' );
848- expect (actions.highlight, true );
849-
850- // Test 2: same rule shouldn't match when room is false
851- event.content['m.mentions' ] = {'room' : false };
852- evaluator = PushruleEvaluator .fromRuleset (roomMentionRuleset);
853- actions = evaluator.match (event);
854- expect (actions.notify, false , reason: 'room=false should not match' );
855-
856- // Test 3: event_property_contains with escaped dot - user mention
857- event.content['m.mentions' ] = {
858- 'user_ids' : ['@alice:example.com' , '@bob:example.com' ],
859- };
860-
861- final userMentionRuleset = PushRuleSet (
862- override: [
863- PushRule (
864- ruleId: '.m.is_user_mention' ,
865- default$: true ,
866- enabled: true ,
867- actions: [
868- 'notify' ,
869- {'set_tweak' : 'highlight' , 'value' : true },
870- {'set_tweak' : 'sound' , 'value' : 'goose.wav' },
871- ],
872- conditions: [
873- PushCondition (
874- kind: 'event_property_contains' ,
875- key: r'content.m\.mentions.user_ids' , // escaped dot!
876- value: '@alice:example.com' ,
877- ),
878- ],
879- ),
880- ],
881- );
882-
883- evaluator = PushruleEvaluator .fromRuleset (userMentionRuleset);
884- actions = evaluator.match (event);
885- expect (actions.notify, true , reason: 'user mention should match' );
886- expect (actions.highlight, true );
887- });
888814 });
889815}
0 commit comments