Skip to content
Snippets Groups Projects
Unverified Commit 9d1971a5 authored by Patrick Cloke's avatar Patrick Cloke Committed by GitHub
Browse files

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.
parent 7564b8e1
No related branches found
No related tags found
No related merge requests found
...@@ -374,7 +374,7 @@ jobs: ...@@ -374,7 +374,7 @@ jobs:
working-directory: complement/dockerfiles working-directory: complement/dockerfiles
# Run Complement # Run Complement
- run: go test -v -tags synapse_blacklist,msc2403,msc2946,msc3083 ./tests/... - run: go test -v -tags synapse_blacklist,msc2403,msc2946 ./tests/...
env: env:
COMPLEMENT_BASE_IMAGE: complement-synapse:latest COMPLEMENT_BASE_IMAGE: complement-synapse:latest
working-directory: complement working-directory: complement
......
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).
...@@ -65,4 +65,4 @@ if [[ -n "$1" ]]; then ...@@ -65,4 +65,4 @@ if [[ -n "$1" ]]; then
fi fi
# Run the tests! # Run the tests!
go test -v -tags synapse_blacklist,msc2946,msc3083,msc2403 -count=1 $EXTRA_COMPLEMENT_ARGS ./tests/... go test -v -tags synapse_blacklist,msc2946,msc2403 -count=1 $EXTRA_COMPLEMENT_ARGS ./tests/...
...@@ -613,8 +613,11 @@ class FederationServer(FederationBase): ...@@ -613,8 +613,11 @@ class FederationServer(FederationBase):
state = await self.store.get_events(state_ids) state = await self.store.get_events(state_ids)
time_now = self._clock.time_msec() time_now = self._clock.time_msec()
event_json = event.get_pdu_json()
return { return {
"org.matrix.msc3083.v2.event": event.get_pdu_json(), # TODO Remove the unstable prefix when servers have updated.
"org.matrix.msc3083.v2.event": event_json,
"event": event_json,
"state": [p.get_pdu_json(time_now) for p in state.values()], "state": [p.get_pdu_json(time_now) for p in state.values()],
"auth_chain": [p.get_pdu_json(time_now) for p in auth_chain], "auth_chain": [p.get_pdu_json(time_now) for p in auth_chain],
} }
......
...@@ -1317,15 +1317,26 @@ class SendJoinParser(ByteParser[SendJoinResponse]): ...@@ -1317,15 +1317,26 @@ class SendJoinParser(ByteParser[SendJoinResponse]):
prefix + "auth_chain.item", prefix + "auth_chain.item",
use_float=True, use_float=True,
) )
self._coro_event = ijson.kvitems_coro( # TODO Remove the unstable prefix when servers have updated.
#
# By re-using the same event dictionary this will cause the parsing of
# org.matrix.msc3083.v2.event and event to stomp over each other.
# Generally this should be fine.
self._coro_unstable_event = ijson.kvitems_coro(
_event_parser(self._response.event_dict), _event_parser(self._response.event_dict),
prefix + "org.matrix.msc3083.v2.event", prefix + "org.matrix.msc3083.v2.event",
use_float=True, use_float=True,
) )
self._coro_event = ijson.kvitems_coro(
_event_parser(self._response.event_dict),
prefix + "event",
use_float=True,
)
def write(self, data: bytes) -> int: def write(self, data: bytes) -> int:
self._coro_state.send(data) self._coro_state.send(data)
self._coro_auth.send(data) self._coro_auth.send(data)
self._coro_unstable_event.send(data)
self._coro_event.send(data) self._coro_event.send(data)
return len(data) return len(data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment