summary refs log tree commit diff
path: root/synapse/events/builder.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-02-07 15:30:04 +0000
committerGitHub <noreply@github.com>2020-02-07 15:30:04 +0000
commit799001f2c0b31d72b95a252a3808da25987e1ed3 (patch)
tree4ef02d19d99632feae18b69907d8a4913ea281ce /synapse/events/builder.py
parentAdd typing to synapse.federation.sender (#6871) (diff)
downloadsynapse-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/events/builder.py')
-rw-r--r--synapse/events/builder.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/synapse/events/builder.py b/synapse/events/builder.py
index 8d63ad6dc3..a0c4a40c27 100644
--- a/synapse/events/builder.py
+++ b/synapse/events/builder.py
@@ -28,11 +28,7 @@ from synapse.api.room_versions import (
     RoomVersion,
 )
 from synapse.crypto.event_signing import add_hashes_and_signatures
-from synapse.events import (
-    EventBase,
-    _EventInternalMetadata,
-    event_type_from_format_version,
-)
+from synapse.events import EventBase, _EventInternalMetadata, make_event_from_dict
 from synapse.types import EventID, JsonDict
 from synapse.util import Clock
 from synapse.util.stringutils import random_string
@@ -256,8 +252,8 @@ def create_local_event_from_event_dict(
     event_dict.setdefault("signatures", {})
 
     add_hashes_and_signatures(room_version, event_dict, hostname, signing_key)
-    return event_type_from_format_version(format_version)(
-        event_dict, internal_metadata_dict=internal_metadata_dict
+    return make_event_from_dict(
+        event_dict, room_version, internal_metadata_dict=internal_metadata_dict
     )