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

Don't bundle aggregations when retrieving the original event #5654

Merged
merged 3 commits into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5654.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug in #5626 that prevented the original_event field from actually having the contents of the original event in a call to `/relations`.
14 changes: 12 additions & 2 deletions synapse/rest/client/v2_alpha/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,18 @@ def on_GET(self, request, room_id, parent_id, relation_type=None, event_type=Non
)

now = self.clock.time_msec()
original_event = yield self._event_serializer.serialize_event(event, now)
events = yield self._event_serializer.serialize_events(events, now)
# We set bundle_aggregations to False when retrieving the original
# event because we want the content before relations were applied to
# it.
original_event = yield self._event_serializer.serialize_event(
event, now, bundle_aggregations=False
)
# Similarly, we don't allow relations to be applied to relations, so we
# return the original relations without any aggregations on top of them
# here.
events = yield self._event_serializer.serialize_events(
events, now, bundle_aggregations=False
)

return_value = result.to_dict()
return_value["chunk"] = events
Expand Down