mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-10 18:26:23 -05:00
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.
This commit is contained in:
parent
b08b0a22d5
commit
799001f2c0
13 changed files with 52 additions and 39 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue