summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2019-01-22 11:12:48 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2019-01-22 12:00:41 +0000
commitc9bfb058d85f6205fada062c78a4d1eca119417c (patch)
treec3b6c29841ca3b82bfec6aa3dd3155531dc77537 /synapse/api
parentAdd changelog (diff)
downloadsynapse-c9bfb058d85f6205fada062c78a4d1eca119417c.tar.xz
Fix a bug with single-room search searching all rooms
* Create a new method for getting predecessor rooms
* Remove formatting change
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/filtering.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py
index 84000e6422..0d8957175d 100644
--- a/synapse/api/filtering.py
+++ b/synapse/api/filtering.py
@@ -444,8 +444,19 @@ class Filter(object):
     def include_redundant_members(self):
         return self.filter_json.get("include_redundant_members", False)
 
-    def add_room_ids(self, room_ids):
-        self.rooms += room_ids
+    def with_room_ids(self, room_ids):
+        """Returns a new filter with the given room IDs appended.
+
+        Args:
+            room_ids (list): A list of room_ids.
+
+        Returns:
+            filter: A new filter including the given rooms and the old
+                    filter's rooms.
+        """
+        newFilter = self
+        newFilter.rooms += room_ids
+        return newFilter
 
 
 def _matches_wildcard(actual_value, filter_value):