summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2024-08-07 17:38:48 +0100
committerErik Johnston <erik@matrix.org>2024-08-07 17:38:48 +0100
commitaa8cda95741aaee92ff503cf441938fe1cb93d85 (patch)
treed49cd3cad9c5d8c61a8d43adea4144eff2cb1199
parentFilter out lazy loading (diff)
downloadsynapse-aa8cda95741aaee92ff503cf441938fe1cb93d85.tar.xz
D'oh
-rw-r--r--synapse/handlers/sliding_sync.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py
index 503b8f36ea..45739ccd35 100644
--- a/synapse/handlers/sliding_sync.py
+++ b/synapse/handlers/sliding_sync.py
@@ -561,11 +561,6 @@ class SlidingSyncHandler:
                             to_token,
                         )
 
-                    # Sort the list
-                    sorted_room_info = await self.sort_rooms(
-                        filtered_sync_room_map, to_token
-                    )
-
                     # Find which rooms are partially stated and may need to be filtered out
                     # depending on the `required_state` requested (see below).
                     partial_state_room_map = (
@@ -586,18 +581,23 @@ class SlidingSyncHandler:
                         and StateValues.LAZY in membership_state_keys
                     )
 
-                    if lazy_loading:
+                    if not lazy_loading:
                         # Exclude partially-stated rooms unless the `required_state`
                         # only has `["m.room.member", "$LAZY"]` for membership
                         # (lazy-loading room members).
                         filtered_sync_room_map = {
                             room_id: room
                             for room_id, room in filtered_sync_room_map.items()
-                            if room_id not in partial_state_room_map
+                            if not partial_state_room_map.get(room_id)
                         }
 
                     all_rooms.update(filtered_sync_room_map)
 
+                    # Sort the list
+                    sorted_room_info = await self.sort_rooms(
+                        filtered_sync_room_map, to_token
+                    )
+
                     ops: List[SlidingSyncResult.SlidingWindowList.Operation] = []
                     if list_config.ranges:
                         for range in list_config.ranges: