forked from MirrorHub/synapse
Signed-off-by: Andrew Ferrazzutti <fair@miscworks.net>
This commit is contained in:
parent
730b40dd5e
commit
30f0240401
1
changelog.d/10963.misc
Normal file
1
changelog.d/10963.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix the test utility function `create_room_as` so that `is_public=True` will explicitly set the `visibility` parameter of room creation requests to `public`. Contributed by @AndrewFerr.
|
|
@ -48,7 +48,7 @@ class RestHelper:
|
||||||
def create_room_as(
|
def create_room_as(
|
||||||
self,
|
self,
|
||||||
room_creator: Optional[str] = None,
|
room_creator: Optional[str] = None,
|
||||||
is_public: bool = True,
|
is_public: Optional[bool] = None,
|
||||||
room_version: Optional[str] = None,
|
room_version: Optional[str] = None,
|
||||||
tok: Optional[str] = None,
|
tok: Optional[str] = None,
|
||||||
expect_code: int = 200,
|
expect_code: int = 200,
|
||||||
|
@ -62,9 +62,10 @@ class RestHelper:
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
room_creator: The user ID to create the room with.
|
room_creator: The user ID to create the room with.
|
||||||
is_public: If True, the `visibility` parameter will be set to the
|
is_public: If True, the `visibility` parameter will be set to
|
||||||
default (public). Otherwise, the `visibility` parameter will be set
|
"public". If False, it will be set to "private". If left
|
||||||
to "private".
|
unspecified, the server will set it to an appropriate default
|
||||||
|
(which should be "private" as per the CS spec).
|
||||||
room_version: The room version to create the room as. Defaults to Synapse's
|
room_version: The room version to create the room as. Defaults to Synapse's
|
||||||
default room version.
|
default room version.
|
||||||
tok: The access token to use in the request.
|
tok: The access token to use in the request.
|
||||||
|
@ -77,8 +78,8 @@ class RestHelper:
|
||||||
self.auth_user_id = room_creator
|
self.auth_user_id = room_creator
|
||||||
path = "/_matrix/client/r0/createRoom"
|
path = "/_matrix/client/r0/createRoom"
|
||||||
content = extra_content or {}
|
content = extra_content or {}
|
||||||
if not is_public:
|
if is_public is not None:
|
||||||
content["visibility"] = "private"
|
content["visibility"] = "public" if is_public else "private"
|
||||||
if room_version:
|
if room_version:
|
||||||
content["room_version"] = room_version
|
content["room_version"] = room_version
|
||||||
if tok:
|
if tok:
|
||||||
|
|
Loading…
Reference in a new issue