summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-10-02 16:50:32 +0100
committerGitHub <noreply@github.com>2019-10-02 16:50:32 +0100
commitdca7e32d3dbee6e7d08c25bdb53250e0e6a78034 (patch)
treee997e6c4ae486eee572b71e9cedc04bc7ce36e80 /synapse
parentMerge pull request #6153 from matrix-org/erikj/fix_room_list_non_federatable (diff)
parentNewsfile (diff)
downloadsynapse-dca7e32d3dbee6e7d08c25bdb53250e0e6a78034.tar.xz
Merge pull request #6154 from matrix-org/erikj/fix_appservice_pagination
Fix appservice room list pagination
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/room.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/synapse/storage/room.py b/synapse/storage/room.py
index 615c0d3f65..43cc56fa6f 100644
--- a/synapse/storage/room.py
+++ b/synapse/storage/room.py
@@ -150,6 +150,24 @@ class RoomWorkerStore(SQLBaseStore):
         where_clauses = []
         query_args = []
 
+        if network_tuple:
+            if network_tuple.appservice_id:
+                published_sql = """
+                    SELECT room_id from appservice_room_list
+                    WHERE appservice_id = ? AND network_id = ?
+                """
+                query_args.append(network_tuple.appservice_id)
+                query_args.append(network_tuple.network_id)
+            else:
+                published_sql = """
+                    SELECT room_id FROM rooms WHERE is_public
+                """
+        else:
+            published_sql = """
+                SELECT room_id FROM rooms WHERE is_public
+                UNION SELECT room_id from appservice_room_list
+            """
+
         # Work out the bounds if we're given them, these bounds look slightly
         # odd, but are designed to help query planner use indices by pulling
         # out a common bound.
@@ -191,24 +209,6 @@ class RoomWorkerStore(SQLBaseStore):
             )
             query_args += [search_term, search_term, search_term]
 
-        if network_tuple:
-            if network_tuple.appservice_id:
-                published_sql = """
-                    SELECT room_id from appservice_room_list
-                    WHERE appservice_id = ? AND network_id = ?
-                """
-                query_args.append(network_tuple.appservice_id)
-                query_args.append(network_tuple.network_id)
-            else:
-                published_sql = """
-                    SELECT room_id FROM rooms WHERE is_public
-                """
-        else:
-            published_sql = """
-                SELECT room_id FROM rooms WHERE is_public
-                UNION SELECT room_id from appservice_room_list
-            """
-
         where_clause = ""
         if where_clauses:
             where_clause = " AND " + " AND ".join(where_clauses)