diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py index 5b834fe9ef..f9ec4f7961 100644 --- a/synapse/handlers/sliding_sync.py +++ b/synapse/handlers/sliding_sync.py @@ -764,6 +764,13 @@ class SlidingSyncHandler: room_id=room_id, # We're going to paginate backwards from the `to_token` from_key=to_token.room_key, + # We should always return historical messages (outside token range) in + # these cases because clients want to be able to show a basic screen of + # information: + # - Initial sync (because no `from_token`) + # - When users newly_join + # - TODO: For incremental sync where we haven't sent it down this + # connection before to_key=from_token.room_key if from_token is not None else None, direction=Direction.BACKWARDS, # We add one so we can determine if there are enough events to saturate @@ -824,14 +831,23 @@ class SlidingSyncHandler: required_state = [] if len(room_sync_config.required_state) > 0: - required_state = await self.storage_controllers.state.get_state_at( + await self.storage_controllers.state.get_current_state( room_id, - to_token, state_filter=StateFilter.from_types(TODO), + await_full_state=False, ) + # TODO: rewind + + # required_state = await self.storage_controllers.state.get_state_at( + # room_id, + # to_token, + # state_filter=StateFilter.from_types(TODO), + # ) + return SlidingSyncResult.RoomResult( # TODO: Dummy value + # TODO: Make this optional because a computed name doesn't make sense for translated cases name="TODO", # TODO: Dummy value avatar=None, diff --git a/synapse/rest/client/sync.py b/synapse/rest/client/sync.py index a9be37bbf3..0ae31f23e9 100644 --- a/synapse/rest/client/sync.py +++ b/synapse/rest/client/sync.py @@ -1021,6 +1021,7 @@ class SlidingSyncRestServlet(RestServlet): # shared between invite and knock rooms, see # https://github.com/matrix-org/matrix-spec-proposals/pull/3575#discussion_r1117629919 serialized_rooms[room_id]["invite_state"] = room_result.stripped_state + # TODO: `knocked_state` but that isn't specced yet return serialized_rooms