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

Commit 9d1971a

Browse files
authored
Return the stable event field from /send_join per MSC3083. (#11413)
This does not remove the unstable field and still parses both. Handling of the unstable field will need to be removed in the future.
1 parent 7564b8e commit 9d1971a

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ jobs:
374374
working-directory: complement/dockerfiles
375375

376376
# Run Complement
377-
- run: go test -v -tags synapse_blacklist,msc2403,msc2946,msc3083 ./tests/...
377+
- run: go test -v -tags synapse_blacklist,msc2403,msc2946 ./tests/...
378378
env:
379379
COMPLEMENT_BASE_IMAGE: complement-synapse:latest
380380
working-directory: complement

changelog.d/11413.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The `/send_join` response now includes the stable `event` field instead of the unstable field from [MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083).

scripts-dev/complement.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ if [[ -n "$1" ]]; then
6565
fi
6666

6767
# Run the tests!
68-
go test -v -tags synapse_blacklist,msc2946,msc3083,msc2403 -count=1 $EXTRA_COMPLEMENT_ARGS ./tests/...
68+
go test -v -tags synapse_blacklist,msc2946,msc2403 -count=1 $EXTRA_COMPLEMENT_ARGS ./tests/...

synapse/federation/federation_server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,11 @@ async def on_send_join_request(
613613
state = await self.store.get_events(state_ids)
614614

615615
time_now = self._clock.time_msec()
616+
event_json = event.get_pdu_json()
616617
return {
617-
"org.matrix.msc3083.v2.event": event.get_pdu_json(),
618+
# TODO Remove the unstable prefix when servers have updated.
619+
"org.matrix.msc3083.v2.event": event_json,
620+
"event": event_json,
618621
"state": [p.get_pdu_json(time_now) for p in state.values()],
619622
"auth_chain": [p.get_pdu_json(time_now) for p in auth_chain],
620623
}

synapse/federation/transport/client.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,15 +1317,26 @@ def __init__(self, room_version: RoomVersion, v1_api: bool):
13171317
prefix + "auth_chain.item",
13181318
use_float=True,
13191319
)
1320-
self._coro_event = ijson.kvitems_coro(
1320+
# TODO Remove the unstable prefix when servers have updated.
1321+
#
1322+
# By re-using the same event dictionary this will cause the parsing of
1323+
# org.matrix.msc3083.v2.event and event to stomp over each other.
1324+
# Generally this should be fine.
1325+
self._coro_unstable_event = ijson.kvitems_coro(
13211326
_event_parser(self._response.event_dict),
13221327
prefix + "org.matrix.msc3083.v2.event",
13231328
use_float=True,
13241329
)
1330+
self._coro_event = ijson.kvitems_coro(
1331+
_event_parser(self._response.event_dict),
1332+
prefix + "event",
1333+
use_float=True,
1334+
)
13251335

13261336
def write(self, data: bytes) -> int:
13271337
self._coro_state.send(data)
13281338
self._coro_auth.send(data)
1339+
self._coro_unstable_event.send(data)
13291340
self._coro_event.send(data)
13301341

13311342
return len(data)

0 commit comments

Comments
 (0)