From 40c8d4d4946623e365dda9c63093cc3483fea4f4 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Wed, 1 Feb 2023 14:51:01 -0500 Subject: [PATCH] Fix case-sensitivity. Note that the Rust code already handles lower-casing / uses case-insensitive regular expressions. --- synapse/push/bulk_push_rule_evaluator.py | 4 +--- tests/push/test_push_rule_evaluator.py | 11 +++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/synapse/push/bulk_push_rule_evaluator.py b/synapse/push/bulk_push_rule_evaluator.py index 7a2a46d39b4f..01d43db3b5df 100644 --- a/synapse/push/bulk_push_rule_evaluator.py +++ b/synapse/push/bulk_push_rule_evaluator.py @@ -503,9 +503,7 @@ def _flatten_dict( if result is None: result = {} for key, value in d.items(): - if isinstance(value, str): - result[".".join(prefix + [key])] = value.lower() - elif isinstance(value, bool) or type(value) is int or value is None: + if isinstance(value, (bool, str)) or type(value) is int or value is None: result[".".join(prefix + [key])] = value elif isinstance(value, Mapping): # do not set `room_version` due to recursion considerations below diff --git a/tests/push/test_push_rule_evaluator.py b/tests/push/test_push_rule_evaluator.py index 1416e7037038..6e4914328645 100644 --- a/tests/push/test_push_rule_evaluator.py +++ b/tests/push/test_push_rule_evaluator.py @@ -358,12 +358,11 @@ def test_exact_event_match_string(self) -> None: {"value": "foobaz"}, "exact value should match", ) - # TODO? - # self._assert_not_matches( - # condition, - # {"value": "FoobaZ"}, - # "values should match and be case-sensitive", - # ) + self._assert_not_matches( + condition, + {"value": "FoobaZ"}, + "values should match and be case-sensitive", + ) self._assert_not_matches( condition, {"value": "test foobaz test"},