Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
71669a0f
Commit
71669a0f
authored
6 years ago
by
Andrew Morgan
Browse files
Options
Downloads
Patches
Plain Diff
Address rich comments
parent
96c40827
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/handlers/room_list.py
+30
-6
30 additions, 6 deletions
synapse/handlers/room_list.py
synapse/server.pyi
+1
-1
1 addition, 1 deletion
synapse/server.pyi
with
31 additions
and
7 deletions
synapse/handlers/room_list.py
+
30
−
6
View file @
71669a0f
...
...
@@ -97,7 +97,23 @@ class RoomListHandler(BaseHandler):
def
_get_public_room_list
(
self
,
limit
=
None
,
since_token
=
None
,
search_filter
=
None
,
network_tuple
=
EMPTY_THIRD_PARTY_ID
,
from_federation
=
False
,
timeout
=
None
,):
from_federation
=
False
,
timeout
=
None
,):
"""
Generate a public room list.
Args:
limit (int): Maximum amount of rooms to return.
since_token (str)
search_filter (dict): Dictionary to filter rooms by.
network_tuple (ThirdPartyInstanceID): Which public list to use.
This can be (None, None) to indicate the main list, or a particular
appservice and network id to use an appservice specific one.
Setting to None returns all public rooms across all lists.
from_federation (bool): Whether this request originated from a
federating server or a client. Used for room filtering.
timeout (int): Amount of seconds to wait for a response before
timing out.
"""
if
since_token
and
since_token
!=
"
END
"
:
since_token
=
RoomListNextBatch
.
from_token
(
since_token
)
else
:
...
...
@@ -295,19 +311,28 @@ class RoomListHandler(BaseHandler):
search_filter
,
from_federation
=
False
):
"""
Generate the entry for a room in the public room list and append it
to the `chunk` if it matches the search filter
Args:
room_id (str): The ID of the room.
num_joined_users (int): The number of joined users in the room.
chunk (list)
limit (int): Maximum amount of rooms to display. Function will
return if length of chunk is greater than limit + 1.
search_filter (dict)
from_federation (bool): Whether this request originated from a
federating server or a client. Used for room filtering.
"""
if
limit
and
len
(
chunk
)
>
limit
+
1
:
# We've already got enough, so lets just drop it.
return
result
=
yield
self
.
generate_room_entry
(
room_id
,
num_joined_users
)
result
=
yield
self
.
generate_room_entry
(
room_id
,
num_joined_users
)
if
from_federation
and
not
self
.
config
.
allow_non_federated_in_public_rooms
:
if
result
[
"
m.federate
"
]
==
False
:
if
result
[
"
m.federate
"
]
is
False
:
# This is a non-federating room and the config has chosen not
# to show these rooms to other servers
chunk
.
append
(
None
)
return
elif
result
and
_matches_room_entry
(
result
,
search_filter
):
chunk
.
append
(
result
)
...
...
@@ -318,7 +343,6 @@ class RoomListHandler(BaseHandler):
Args:
room_id (str): The room
'
s ID.
disabled should be shown.
num_joined_users (int): Number of users in the room.
cache_context: Information for cached responses.
with_alias (bool): Whether to return the room
'
s aliases in the result.
...
...
This diff is collapsed.
Click to expand it.
synapse/server.pyi
+
1
−
1
View file @
71669a0f
...
...
@@ -7,9 +7,9 @@ import synapse.handlers.auth
import
synapse.handlers.deactivate_account
import
synapse.handlers.device
import
synapse.handlers.e2e_keys
import
synapse.handlers.message
import
synapse.handlers.room
import
synapse.handlers.room_member
import
synapse.handlers.message
import
synapse.handlers.set_password
import
synapse.rest.media.v1.media_repository
import
synapse.server_notices.server_notices_manager
...
...
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