0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-16 11:43:51 +01:00

Correct docstring types and chunk logic

This commit is contained in:
Andrew Morgan 2019-02-26 12:12:48 +00:00
parent 40c2271680
commit 16565e67db

View file

@ -59,9 +59,9 @@ class RoomListHandler(BaseHandler):
party network. A client can ask for a specific list or to return all. party network. A client can ask for a specific list or to return all.
Args: Args:
limit (int) limit (int|None)
since_token (str) since_token (str|None)
search_filter (dict) search_filter (dict|None)
network_tuple (ThirdPartyInstanceID): Which public list to use. network_tuple (ThirdPartyInstanceID): Which public list to use.
This can be (None, None) to indicate the main list, or a particular This can be (None, None) to indicate the main list, or a particular
appservice and network id to use an appservice specific one. appservice and network id to use an appservice specific one.
@ -102,16 +102,16 @@ class RoomListHandler(BaseHandler):
"""Generate a public room list. """Generate a public room list.
Args: Args:
limit (int): Maximum amount of rooms to return. limit (int|None): Maximum amount of rooms to return.
since_token (str) since_token (str|None)
search_filter (dict): Dictionary to filter rooms by. search_filter (dict|None): Dictionary to filter rooms by.
network_tuple (ThirdPartyInstanceID): Which public list to use. network_tuple (ThirdPartyInstanceID): Which public list to use.
This can be (None, None) to indicate the main list, or a particular This can be (None, None) to indicate the main list, or a particular
appservice and network id to use an appservice specific one. appservice and network id to use an appservice specific one.
Setting to None returns all public rooms across all lists. Setting to None returns all public rooms across all lists.
from_federation (bool): Whether this request originated from a from_federation (bool): Whether this request originated from a
federating server or a client. Used for room filtering. federating server or a client. Used for room filtering.
timeout (int): Amount of seconds to wait for a response before timeout (int|None): Amount of seconds to wait for a response before
timing out. timing out.
""" """
if since_token and since_token != "END": if since_token and since_token != "END":
@ -316,9 +316,9 @@ class RoomListHandler(BaseHandler):
room_id (str): The ID of the room. room_id (str): The ID of the room.
num_joined_users (int): The number of joined users in the room. num_joined_users (int): The number of joined users in the room.
chunk (list) chunk (list)
limit (int): Maximum amount of rooms to display. Function will limit (int|None): Maximum amount of rooms to display. Function will
return if length of chunk is greater than limit + 1. return if length of chunk is greater than limit + 1.
search_filter (dict) search_filter (dict|None)
from_federation (bool): Whether this request originated from a from_federation (bool): Whether this request originated from a
federating server or a client. Used for room filtering. federating server or a client. Used for room filtering.
""" """
@ -330,7 +330,8 @@ class RoomListHandler(BaseHandler):
if not result: if not result:
return return
if from_federation and result["m.federate"] is False: if from_federation:
if "m.federate" in result and not result["m.federate"]:
# This is a room that other servers cannot join. Do not show them # This is a room that other servers cannot join. Do not show them
# this room. # this room.
return return