diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2020-02-07 15:30:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 15:30:04 +0000 |
commit | 799001f2c0b31d72b95a252a3808da25987e1ed3 (patch) | |
tree | 4ef02d19d99632feae18b69907d8a4913ea281ce /synapse/federation/federation_base.py | |
parent | Add typing to synapse.federation.sender (#6871) (diff) | |
download | synapse-799001f2c0b31d72b95a252a3808da25987e1ed3.tar.xz |
Add a `make_event_from_dict` method (#6858)
... and use it in places where it's trivial to do so. This will make it easier to pass room versions into the FrozenEvent constructors.
Diffstat (limited to 'synapse/federation/federation_base.py')
-rw-r--r-- | synapse/federation/federation_base.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/synapse/federation/federation_base.py b/synapse/federation/federation_base.py index ebe8b8e9fe..eea64c1c9f 100644 --- a/synapse/federation/federation_base.py +++ b/synapse/federation/federation_base.py @@ -29,7 +29,7 @@ from synapse.api.room_versions import ( RoomVersion, ) from synapse.crypto.event_signing import check_event_content_hash -from synapse.events import EventBase, event_type_from_format_version +from synapse.events import EventBase, make_event_from_dict from synapse.events.utils import prune_event from synapse.http.servlet import assert_params_in_dict from synapse.logging.context import ( @@ -374,8 +374,7 @@ def event_from_pdu_json( elif depth > MAX_DEPTH: raise SynapseError(400, "Depth too large", Codes.BAD_JSON) - event = event_type_from_format_version(room_version.event_format)(pdu_json) - + event = make_event_from_dict(pdu_json, room_version) event.internal_metadata.outlier = outlier return event |