summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2016-09-17 01:40:31 +0100
committerMatthew Hodgson <matthew@matrix.org>2016-09-17 01:40:31 +0100
commiteecc2b6296133382bbb39512a955dade1371fb07 (patch)
treee0933e07ec3328528121eb34a8b8b7c992ff43dc
parentFix public room pagination for client_reader app (diff)
downloadsynapse-matthew/fix-roomdir-pagination.tar.xz
i think this fixes the room pagination limit. github/matthew/fix-roomdir-pagination matthew/fix-roomdir-pagination
rather than aborting on the final partial pagination, it instead paginates the remainder, and then aborts if you try to go any further.
-rw-r--r--synapse/handlers/room_list.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/handlers/room_list.py b/synapse/handlers/room_list.py
index f15987b265..28c7523b7c 100644
--- a/synapse/handlers/room_list.py
+++ b/synapse/handlers/room_list.py
@@ -238,9 +238,12 @@ class RoomListHandler(BaseHandler):
                 addition *= -1
 
             try:
-                new_limit = sorted_rooms.index(last_room_id) + addition
-                if new_limit >= len(sorted_rooms):
+                if sorted_rooms.index(last_room_id) == len(sorted_rooms):
                     new_limit = None
+                else:
+                    new_limit = sorted_rooms.index(last_room_id) + addition
+                    if new_limit >= len(sorted_rooms):
+                        new_limit = len(sorted_rooms)
             except ValueError:
                 pass