mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-10 22:57:41 -05:00
Rename the EventFormatVersions enum values so that they line up with room version numbers. (#13706)
This commit is contained in:
parent
bb5b47b62a
commit
c2fe48a6ff
13 changed files with 47 additions and 41 deletions
|
|
@ -442,7 +442,7 @@ class EventBase(metaclass=abc.ABCMeta):
|
|||
|
||||
|
||||
class FrozenEvent(EventBase):
|
||||
format_version = EventFormatVersions.V1 # All events of this type are V1
|
||||
format_version = EventFormatVersions.ROOM_V1_V2 # All events of this type are V1
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
@ -490,7 +490,7 @@ class FrozenEvent(EventBase):
|
|||
|
||||
|
||||
class FrozenEventV2(EventBase):
|
||||
format_version = EventFormatVersions.V2 # All events of this type are V2
|
||||
format_version = EventFormatVersions.ROOM_V3 # All events of this type are V2
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
@ -567,7 +567,7 @@ class FrozenEventV2(EventBase):
|
|||
class FrozenEventV3(FrozenEventV2):
|
||||
"""FrozenEventV3, which differs from FrozenEventV2 only in the event_id format"""
|
||||
|
||||
format_version = EventFormatVersions.V3 # All events of this type are V3
|
||||
format_version = EventFormatVersions.ROOM_V4_PLUS # All events of this type are V3
|
||||
|
||||
@property
|
||||
def event_id(self) -> str:
|
||||
|
|
@ -597,11 +597,11 @@ def _event_type_from_format_version(
|
|||
`FrozenEvent`
|
||||
"""
|
||||
|
||||
if format_version == EventFormatVersions.V1:
|
||||
if format_version == EventFormatVersions.ROOM_V1_V2:
|
||||
return FrozenEvent
|
||||
elif format_version == EventFormatVersions.V2:
|
||||
elif format_version == EventFormatVersions.ROOM_V3:
|
||||
return FrozenEventV2
|
||||
elif format_version == EventFormatVersions.V3:
|
||||
elif format_version == EventFormatVersions.ROOM_V4_PLUS:
|
||||
return FrozenEventV3
|
||||
else:
|
||||
raise Exception("No event format %r" % (format_version,))
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ class EventBuilder:
|
|||
# The types of auth/prev events changes between event versions.
|
||||
prev_events: Union[List[str], List[Tuple[str, Dict[str, str]]]]
|
||||
auth_events: Union[List[str], List[Tuple[str, Dict[str, str]]]]
|
||||
if format_version == EventFormatVersions.V1:
|
||||
if format_version == EventFormatVersions.ROOM_V1_V2:
|
||||
auth_events = await self._store.add_event_hashes(auth_event_ids)
|
||||
prev_events = await self._store.add_event_hashes(prev_event_ids)
|
||||
else:
|
||||
|
|
@ -253,7 +253,7 @@ def create_local_event_from_event_dict(
|
|||
|
||||
time_now = int(clock.time_msec())
|
||||
|
||||
if format_version == EventFormatVersions.V1:
|
||||
if format_version == EventFormatVersions.ROOM_V1_V2:
|
||||
event_dict["event_id"] = _create_event_id(clock, hostname)
|
||||
|
||||
event_dict["origin"] = hostname
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class EventValidator:
|
|||
"""
|
||||
self.validate_builder(event)
|
||||
|
||||
if event.format_version == EventFormatVersions.V1:
|
||||
if event.format_version == EventFormatVersions.ROOM_V1_V2:
|
||||
EventID.from_string(event.event_id)
|
||||
|
||||
required = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue