mirror of
https://github.com/element-hq/synapse
synced 2024-09-07 11:40:05 +00:00
Fix appservice room list pagination
This commit is contained in:
parent
824df3ead4
commit
7a5f080f91
1 changed files with 18 additions and 18 deletions
|
@ -150,6 +150,24 @@ class RoomWorkerStore(SQLBaseStore):
|
||||||
where_clauses = []
|
where_clauses = []
|
||||||
query_args = []
|
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
|
# 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
|
# odd, but are designed to help query planner use indices by pulling
|
||||||
# out a common bound.
|
# out a common bound.
|
||||||
|
@ -188,24 +206,6 @@ class RoomWorkerStore(SQLBaseStore):
|
||||||
)
|
)
|
||||||
query_args += [search_term, search_term, search_term]
|
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 = ""
|
where_clause = ""
|
||||||
if where_clauses:
|
if where_clauses:
|
||||||
where_clause = " AND " + " AND ".join(where_clauses)
|
where_clause = " AND " + " AND ".join(where_clauses)
|
||||||
|
|
Loading…
Reference in a new issue