mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 08:56:04 -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
|
@ -22,6 +22,7 @@ from typing import (
|
|||
Dict,
|
||||
Iterable,
|
||||
List,
|
||||
Mapping,
|
||||
Optional,
|
||||
Set,
|
||||
TypeVar,
|
||||
|
@ -361,10 +362,10 @@ class Filter:
|
|||
return self._check_fields(field_matchers)
|
||||
else:
|
||||
content = event.get("content")
|
||||
# Content is assumed to be a dict below, so ensure it is. This should
|
||||
# Content is assumed to be a mapping below, so ensure it is. This should
|
||||
# always be true for events, but account_data has been allowed to
|
||||
# have non-dict content.
|
||||
if not isinstance(content, dict):
|
||||
if not isinstance(content, Mapping):
|
||||
content = {}
|
||||
|
||||
sender = event.get("sender", None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue