Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

i think this fixes the room pagination limit. #1128

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions synapse/handlers/room_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,12 @@ def handle_room(room_id):
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):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, this looks like it should be len() - 1

actually, i've got confused again on how this is meant to work. This would be so much clearer with a few more comments......

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the index will always be strictly less than len.

A comment as to why you're choosing to stop then might be equally helpful. :)

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

Expand Down