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

Commit 98a3355

Browse files
authored
Update the pagination parameter name based on MSC2946 review. (#10579)
1 parent 915b37e commit 98a3355

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

changelog.d/10579.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add pagination to the spaces summary based on updates to [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946).

synapse/handlers/space_summary.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,10 @@ async def _get_room_hierarchy(
412412

413413
# If there's additional data, generate a pagination token (and persist state).
414414
if room_queue:
415-
next_token = random_string(24)
416-
result["next_token"] = next_token
415+
next_batch = random_string(24)
416+
result["next_batch"] = next_batch
417417
pagination_key = _PaginationKey(
418-
requested_room_id, suggested_only, max_depth, next_token
418+
requested_room_id, suggested_only, max_depth, next_batch
419419
)
420420
self._pagination_sessions[pagination_key] = _PaginationSession(
421421
self._clock.time_msec(), room_queue, processed_rooms

tests/handlers/test_space_summary.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -466,19 +466,19 @@ def test_pagination(self):
466466
expected: List[Tuple[str, Iterable[str]]] = [(self.space, room_ids)]
467467
expected += [(room_id, ()) for room_id in room_ids[:6]]
468468
self._assert_hierarchy(result, expected)
469-
self.assertIn("next_token", result)
469+
self.assertIn("next_batch", result)
470470

471471
# Check the next page.
472472
result = self.get_success(
473473
self.handler.get_room_hierarchy(
474-
self.user, self.space, limit=5, from_token=result["next_token"]
474+
self.user, self.space, limit=5, from_token=result["next_batch"]
475475
)
476476
)
477477
# The result should have the space and the room in it, along with a link
478478
# from space -> room.
479479
expected = [(room_id, ()) for room_id in room_ids[6:]]
480480
self._assert_hierarchy(result, expected)
481-
self.assertNotIn("next_token", result)
481+
self.assertNotIn("next_batch", result)
482482

483483
def test_invalid_pagination_token(self):
484484
""""""
@@ -493,12 +493,12 @@ def test_invalid_pagination_token(self):
493493
result = self.get_success(
494494
self.handler.get_room_hierarchy(self.user, self.space, limit=7)
495495
)
496-
self.assertIn("next_token", result)
496+
self.assertIn("next_batch", result)
497497

498498
# Changing the room ID, suggested-only, or max-depth causes an error.
499499
self.get_failure(
500500
self.handler.get_room_hierarchy(
501-
self.user, self.room, from_token=result["next_token"]
501+
self.user, self.room, from_token=result["next_batch"]
502502
),
503503
SynapseError,
504504
)
@@ -507,13 +507,13 @@ def test_invalid_pagination_token(self):
507507
self.user,
508508
self.space,
509509
suggested_only=True,
510-
from_token=result["next_token"],
510+
from_token=result["next_batch"],
511511
),
512512
SynapseError,
513513
)
514514
self.get_failure(
515515
self.handler.get_room_hierarchy(
516-
self.user, self.space, max_depth=0, from_token=result["next_token"]
516+
self.user, self.space, max_depth=0, from_token=result["next_batch"]
517517
),
518518
SynapseError,
519519
)

0 commit comments

Comments
 (0)