mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 00:24:54 -04:00
Fix bundling aggregations if unsigned is not a returned event field. (#12234)
An error occured if a filter was supplied with `event_fields` which did not include `unsigned`. In that case, bundled aggregations are still added as the spec states it is allowed for servers to add additional fields.
This commit is contained in:
parent
9e90d643e6
commit
96274565ff
3 changed files with 35 additions and 3 deletions
|
@ -530,9 +530,12 @@ class EventClientSerializer:
|
|||
|
||||
# Include the bundled aggregations in the event.
|
||||
if serialized_aggregations:
|
||||
serialized_event["unsigned"].setdefault("m.relations", {}).update(
|
||||
serialized_aggregations
|
||||
)
|
||||
# There is likely already an "unsigned" field, but a filter might
|
||||
# have stripped it off (via the event_fields option). The server is
|
||||
# allowed to return additional fields, so add it back.
|
||||
serialized_event.setdefault("unsigned", {}).setdefault(
|
||||
"m.relations", {}
|
||||
).update(serialized_aggregations)
|
||||
|
||||
def serialize_events(
|
||||
self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue