Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Drop backwards compat hack for event serialization (#16069)
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Shay authored Aug 7, 2023
1 parent 9d3713d commit 81a6f8c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
1 change: 1 addition & 0 deletions changelog.d/16069.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop backwards compat hack for event serialization.
12 changes: 1 addition & 11 deletions synapse/events/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ async def serialize(self, event: EventBase, store: "DataStore") -> JsonDict:
),
"app_service_id": self.app_service.id if self.app_service else None,
"partial_state": self.partial_state,
# add dummy delta_ids and prev_group for backwards compatibility
"delta_ids": None,
"prev_group": None,
}

@staticmethod
Expand All @@ -203,21 +200,14 @@ def deserialize(storage: "StorageControllers", input: JsonDict) -> "EventContext
Returns:
The event context.
"""
# workaround for backwards/forwards compatibility: if the input doesn't have a value
# for "state_group_deltas" just assign an empty dict
state_group_deltas = input.get("state_group_deltas", None)
if state_group_deltas:
state_group_deltas = _decode_state_group_delta(state_group_deltas)
else:
state_group_deltas = {}

context = EventContext(
# We use the state_group and prev_state_id stuff to pull the
# current_state_ids out of the DB and construct prev_state_ids.
storage=storage,
state_group=input["state_group"],
state_group_before_event=input["state_group_before_event"],
state_group_deltas=state_group_deltas,
state_group_deltas=_decode_state_group_delta(input["state_group_deltas"]),
state_delta_due_to_event=_decode_state_dict(
input["state_delta_due_to_event"]
),
Expand Down

0 comments on commit 81a6f8c

Please sign in to comment.