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

Commit

Permalink
Only return state events that the AS passed in via `state_events_at_s…
Browse files Browse the repository at this point in the history
…tart` (MSC2716) (#10552)

* Only return state events that the AS passed in via state_events_at_start

As discovered by @Half-Shot in
matrix-org/matrix-spec-proposals#2716 (comment)

Part of MSC2716

* Add changelog

* Fix changelog extension
  • Loading branch information
MadLittleMods authored Aug 10, 2021
1 parent fe1d0c8 commit 8c654b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/10552.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update `/batch_send` endpoint to only return `state_events` created by the `state_events_from_before` passed in.
4 changes: 3 additions & 1 deletion synapse/rest/client/v1/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ async def on_POST(self, request, room_id):
prev_state_ids = list(prev_state_map.values())
auth_event_ids = prev_state_ids

state_events_at_start = []
for state_event in body["state_events_at_start"]:
assert_params_in_dict(
state_event, ["type", "origin_server_ts", "content", "sender"]
Expand Down Expand Up @@ -502,6 +503,7 @@ async def on_POST(self, request, room_id):
)
event_id = event.event_id

state_events_at_start.append(event_id)
auth_event_ids.append(event_id)

events_to_create = body["events"]
Expand Down Expand Up @@ -651,7 +653,7 @@ async def on_POST(self, request, room_id):
event_ids.append(base_insertion_event.event_id)

return 200, {
"state_events": auth_event_ids,
"state_events": state_events_at_start,
"events": event_ids,
"next_chunk_id": insertion_event["content"][
EventContentFields.MSC2716_NEXT_CHUNK_ID
Expand Down

0 comments on commit 8c654b7

Please sign in to comment.