summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2024-07-11 10:03:04 +0100
committerErik Johnston <erik@matrix.org>2024-07-11 10:03:04 +0100
commit1c63161caa2d7969e819ba0ce24b56e75691f40d (patch)
treefbc35d5295eb5dad69f151df4e324cf84322a2a6 /synapse/handlers
parentFixup (diff)
downloadsynapse-1c63161caa2d7969e819ba0ce24b56e75691f40d.tar.xz
FIXUP
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/sliding_sync.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py
index 935df9a8ca..7926b34c4d 100644
--- a/synapse/handlers/sliding_sync.py
+++ b/synapse/handlers/sliding_sync.py
@@ -445,10 +445,6 @@ class SlidingSyncHandler:
             for list_key, list_config in sync_config.lists.items():
                 # Apply filters
                 filtered_sync_room_map = sync_room_map
-                if list_config.filters is not None:
-                    filtered_sync_room_map = await self.filter_rooms(
-                        sync_config.user, sync_room_map, list_config.filters, to_token
-                    )
 
                 # Sort the list
                 sorted_room_info = await self.sort_rooms(
@@ -497,6 +493,14 @@ class SlidingSyncHandler:
                             if partial_state_room_map.get(room_id) and not lazy_loading:
                                 continue
 
+                            if list_config.filters and not await self.filter_rooms(
+                                sync_config.user,
+                                {room_id: room_membership},
+                                list_config.filters,
+                                to_token,
+                            ):
+                                continue
+
                             # Take the superset of the `RoomSyncConfig` for each room.
                             #
                             # Update our `relevant_room_map` with the room we're going
@@ -966,9 +970,7 @@ class SlidingSyncHandler:
         # Filter by room type (space vs room, etc). A room must match one of the types
         # provided in the list. `None` is a valid type for rooms which do not have a
         # room type.
-        if False and (
-            filters.room_types is not None or filters.not_room_types is not None
-        ):
+        if filters.room_types is not None or filters.not_room_types is not None:
             # Make a copy so we don't run into an error: `Set changed size during
             # iteration`, when we filter out and remove items
             for room_id in filtered_room_id_set.copy():