Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit ec79870

Browse files
authored
Fix a typo in MSC3873 config option. (#15138)
Previously the experimental configuration option referred to the wrong MSC number.
1 parent 1a1738e commit ec79870

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

changelog.d/15138.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a typo in an experimental config setting.

synapse/config/experimental.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
175175
)
176176

177177
# MSC3873: Disambiguate event_match keys.
178-
self.msc3783_escape_event_match_key = experimental.get(
179-
"msc3783_escape_event_match_key", False
178+
self.msc3873_escape_event_match_key = experimental.get(
179+
"msc3873_escape_event_match_key", False
180180
)
181181

182182
# MSC3952: Intentional mentions, this depends on MSC3758.

synapse/push/bulk_push_rule_evaluator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ async def _related_events(
276276
if related_event is not None:
277277
related_events[relation_type] = _flatten_dict(
278278
related_event,
279-
msc3783_escape_event_match_key=self.hs.config.experimental.msc3783_escape_event_match_key,
279+
msc3873_escape_event_match_key=self.hs.config.experimental.msc3873_escape_event_match_key,
280280
)
281281

282282
reply_event_id = (
@@ -294,7 +294,7 @@ async def _related_events(
294294
if related_event is not None:
295295
related_events["m.in_reply_to"] = _flatten_dict(
296296
related_event,
297-
msc3783_escape_event_match_key=self.hs.config.experimental.msc3783_escape_event_match_key,
297+
msc3873_escape_event_match_key=self.hs.config.experimental.msc3873_escape_event_match_key,
298298
)
299299

300300
# indicate that this is from a fallback relation.
@@ -412,7 +412,7 @@ async def _action_for_event_by_user(
412412
evaluator = PushRuleEvaluator(
413413
_flatten_dict(
414414
event,
415-
msc3783_escape_event_match_key=self.hs.config.experimental.msc3783_escape_event_match_key,
415+
msc3873_escape_event_match_key=self.hs.config.experimental.msc3873_escape_event_match_key,
416416
),
417417
has_mentions,
418418
user_mentions,
@@ -507,7 +507,7 @@ def _flatten_dict(
507507
prefix: Optional[List[str]] = None,
508508
result: Optional[Dict[str, JsonValue]] = None,
509509
*,
510-
msc3783_escape_event_match_key: bool = False,
510+
msc3873_escape_event_match_key: bool = False,
511511
) -> Dict[str, JsonValue]:
512512
"""
513513
Given a JSON dictionary (or event) which might contain sub dictionaries,
@@ -536,7 +536,7 @@ def _flatten_dict(
536536
if result is None:
537537
result = {}
538538
for key, value in d.items():
539-
if msc3783_escape_event_match_key:
539+
if msc3873_escape_event_match_key:
540540
# Escape periods in the key with a backslash (and backslashes with an
541541
# extra backslash). This is since a period is used as a separator between
542542
# nested fields.
@@ -552,7 +552,7 @@ def _flatten_dict(
552552
value,
553553
prefix=(prefix + [key]),
554554
result=result,
555-
msc3783_escape_event_match_key=msc3783_escape_event_match_key,
555+
msc3873_escape_event_match_key=msc3873_escape_event_match_key,
556556
)
557557

558558
# `room_version` should only ever be set when looking at the top level of an event

tests/push/test_push_rule_evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_nested(self) -> None:
5454
self.assertEqual({"m.foo.b\\ar": "abc"}, _flatten_dict(input))
5555
self.assertEqual(
5656
{"m\\.foo.b\\\\ar": "abc"},
57-
_flatten_dict(input, msc3783_escape_event_match_key=True),
57+
_flatten_dict(input, msc3873_escape_event_match_key=True),
5858
)
5959

6060
def test_non_string(self) -> None:

0 commit comments

Comments
 (0)