mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 13:54:55 -04:00
Fix PushRuleEvaluator
and Filter
to work on frozendicts (#12100)
* Fix `PushRuleEvaluator` to work on frozendicts frozendicts do not (necessarily) inherit from dict, so this needs to handle them correctly. * Fix event filtering for frozen events Looks like this one was introduced by #11194.
This commit is contained in:
parent
5565f454e1
commit
6c0b44a3d7
5 changed files with 27 additions and 6 deletions
|
@ -14,6 +14,8 @@
|
|||
|
||||
from typing import Any, Dict
|
||||
|
||||
import frozendict
|
||||
|
||||
from synapse.api.room_versions import RoomVersions
|
||||
from synapse.events import FrozenEvent
|
||||
from synapse.push import push_rule_evaluator
|
||||
|
@ -191,6 +193,13 @@ class PushRuleEvaluatorTestCase(unittest.TestCase):
|
|||
"pattern should only match at the start/end of the value",
|
||||
)
|
||||
|
||||
# it should work on frozendicts too
|
||||
self._assert_matches(
|
||||
condition,
|
||||
frozendict.frozendict({"value": "FoobaZ"}),
|
||||
"patterns should match on frozendicts",
|
||||
)
|
||||
|
||||
# wildcards should match
|
||||
condition = {
|
||||
"kind": "event_match",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue