Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
98a3355d
Unverified
Commit
98a3355d
authored
3 years ago
by
Patrick Cloke
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update the pagination parameter name based on MSC2946 review. (#10579)
parent
915b37e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changelog.d/10579.feature
+1
-0
1 addition, 0 deletions
changelog.d/10579.feature
synapse/handlers/space_summary.py
+3
-3
3 additions, 3 deletions
synapse/handlers/space_summary.py
tests/handlers/test_space_summary.py
+7
-7
7 additions, 7 deletions
tests/handlers/test_space_summary.py
with
11 additions
and
10 deletions
changelog.d/10579.feature
0 → 100644
+
1
−
0
View file @
98a3355d
Add pagination to the spaces summary based on updates to [MSC2946](https
:
//github.com/matrix-org/matrix-doc/pull/2946).
This diff is collapsed.
Click to expand it.
synapse/handlers/space_summary.py
+
3
−
3
View file @
98a3355d
...
...
@@ -412,10 +412,10 @@ class SpaceSummaryHandler:
# If there's additional data, generate a pagination token (and persist state).
if
room_queue
:
next_
token
=
random_string
(
24
)
result
[
"
next_
token
"
]
=
next_
token
next_
batch
=
random_string
(
24
)
result
[
"
next_
batch
"
]
=
next_
batch
pagination_key
=
_PaginationKey
(
requested_room_id
,
suggested_only
,
max_depth
,
next_
token
requested_room_id
,
suggested_only
,
max_depth
,
next_
batch
)
self
.
_pagination_sessions
[
pagination_key
]
=
_PaginationSession
(
self
.
_clock
.
time_msec
(),
room_queue
,
processed_rooms
...
...
This diff is collapsed.
Click to expand it.
tests/handlers/test_space_summary.py
+
7
−
7
View file @
98a3355d
...
...
@@ -466,19 +466,19 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
expected
:
List
[
Tuple
[
str
,
Iterable
[
str
]]]
=
[(
self
.
space
,
room_ids
)]
expected
+=
[(
room_id
,
())
for
room_id
in
room_ids
[:
6
]]
self
.
_assert_hierarchy
(
result
,
expected
)
self
.
assertIn
(
"
next_
token
"
,
result
)
self
.
assertIn
(
"
next_
batch
"
,
result
)
# Check the next page.
result
=
self
.
get_success
(
self
.
handler
.
get_room_hierarchy
(
self
.
user
,
self
.
space
,
limit
=
5
,
from_token
=
result
[
"
next_
token
"
]
self
.
user
,
self
.
space
,
limit
=
5
,
from_token
=
result
[
"
next_
batch
"
]
)
)
# The result should have the space and the room in it, along with a link
# from space -> room.
expected
=
[(
room_id
,
())
for
room_id
in
room_ids
[
6
:]]
self
.
_assert_hierarchy
(
result
,
expected
)
self
.
assertNotIn
(
"
next_
token
"
,
result
)
self
.
assertNotIn
(
"
next_
batch
"
,
result
)
def
test_invalid_pagination_token
(
self
):
""""""
...
...
@@ -493,12 +493,12 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
result
=
self
.
get_success
(
self
.
handler
.
get_room_hierarchy
(
self
.
user
,
self
.
space
,
limit
=
7
)
)
self
.
assertIn
(
"
next_
token
"
,
result
)
self
.
assertIn
(
"
next_
batch
"
,
result
)
# Changing the room ID, suggested-only, or max-depth causes an error.
self
.
get_failure
(
self
.
handler
.
get_room_hierarchy
(
self
.
user
,
self
.
room
,
from_token
=
result
[
"
next_
token
"
]
self
.
user
,
self
.
room
,
from_token
=
result
[
"
next_
batch
"
]
),
SynapseError
,
)
...
...
@@ -507,13 +507,13 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
self
.
user
,
self
.
space
,
suggested_only
=
True
,
from_token
=
result
[
"
next_
token
"
],
from_token
=
result
[
"
next_
batch
"
],
),
SynapseError
,
)
self
.
get_failure
(
self
.
handler
.
get_room_hierarchy
(
self
.
user
,
self
.
space
,
max_depth
=
0
,
from_token
=
result
[
"
next_
token
"
]
self
.
user
,
self
.
space
,
max_depth
=
0
,
from_token
=
result
[
"
next_
batch
"
]
),
SynapseError
,
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment