diff options
author | Richard van der Hoff <richard@matrix.org> | 2020-01-29 17:55:48 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2020-01-30 22:15:50 +0000 |
commit | ef6bdafb29abe14cb40f6b83a46e70d82cd3e041 (patch) | |
tree | 1d65fb57a50386588b25383aa78bb099e795850d /synapse/events/builder.py | |
parent | MSC2260: Block direct sends of m.room.aliases events (#6794) (diff) | |
download | synapse-ef6bdafb29abe14cb40f6b83a46e70d82cd3e041.tar.xz |
Store the room version in EventBuilder
Diffstat (limited to 'synapse/events/builder.py')
-rw-r--r-- | synapse/events/builder.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/synapse/events/builder.py b/synapse/events/builder.py index 3997751337..291fb38a26 100644 --- a/synapse/events/builder.py +++ b/synapse/events/builder.py @@ -23,6 +23,7 @@ from synapse.api.room_versions import ( KNOWN_EVENT_FORMAT_VERSIONS, KNOWN_ROOM_VERSIONS, EventFormatVersions, + RoomVersion, ) from synapse.crypto.event_signing import add_hashes_and_signatures from synapse.types import EventID @@ -40,7 +41,7 @@ class EventBuilder(object): content/unsigned/internal_metadata fields are still mutable) Attributes: - format_version (int): Event format version + room_version: Version of the target room room_id (str) type (str) sender (str) @@ -63,7 +64,7 @@ class EventBuilder(object): _hostname = attr.ib() _signing_key = attr.ib() - format_version = attr.ib() + room_version = attr.ib(type=RoomVersion) room_id = attr.ib() type = attr.ib() @@ -108,7 +109,8 @@ class EventBuilder(object): ) auth_ids = yield self._auth.compute_auth_events(self, state_ids) - if self.format_version == EventFormatVersions.V1: + format_version = self.room_version.event_format + if format_version == EventFormatVersions.V1: auth_events = yield self._store.add_event_hashes(auth_ids) prev_events = yield self._store.add_event_hashes(prev_event_ids) else: @@ -148,7 +150,7 @@ class EventBuilder(object): clock=self._clock, hostname=self._hostname, signing_key=self._signing_key, - format_version=self.format_version, + format_version=format_version, event_dict=event_dict, internal_metadata_dict=self.internal_metadata.get_dict(), ) @@ -201,7 +203,7 @@ class EventBuilderFactory(object): clock=self.clock, hostname=self.hostname, signing_key=self.signing_key, - format_version=room_version.event_format, + room_version=room_version, type=key_values["type"], state_key=key_values.get("state_key"), room_id=key_values["room_id"], |