diff --git a/docs/admin_api/rooms.md b/docs/admin_api/rooms.md index 0c9dfcf7201a..c47c23387525 100644 --- a/docs/admin_api/rooms.md +++ b/docs/admin_api/rooms.md @@ -400,10 +400,10 @@ as room administrator and will contain a message explaining what happened. Users to the new room will have power level `-10` by default, and thus be unable to speak. If `block` is `true`, users will be prevented from joining the old room. -This option can also be used to pre-emptively block a room, even if it's unknown -to this homeserver. In this case, the room will be blocked, and no further action -will be taken. If `block` is `false`, attempting to delete an unknown room is -invalid and will be rejected as a bad request. +This option can in [Version 1](#version-1-old-version) also be used to pre-emptively +block a room, even if it's unknown to this homeserver. In this case, the room will be +blocked, and no further action will be taken. If `block` is `false`, attempting to +delete an unknown room is invalid and will be rejected as a bad request. This API will remove all trace of the old room from your database after removing all local users. If `purge` is `true` (the default), all traces of the old room will @@ -519,7 +519,8 @@ The following JSON body parameters are available: is not permitted and rooms in violation will be blocked.` * `block` - Optional. If set to `true`, this room will be added to a blocking list, preventing future attempts to join the room. Rooms can be blocked - even if they're not yet known to the homeserver. Defaults to `false`. + even if they're not yet known to the homeserver (only with + [Version 1](#version-1-old-version) of the API). Defaults to `false`. * `purge` - Optional. If set to `true`, it will remove all traces of the room from your database. Defaults to `true`. * `force_purge` - Optional, and ignored unless `purge` is `true`. If set to `true`, it diff --git a/synapse/rest/admin/rooms.py b/synapse/rest/admin/rooms.py index 05fc192eb780..2eecd39d6f04 100644 --- a/synapse/rest/admin/rooms.py +++ b/synapse/rest/admin/rooms.py @@ -153,7 +153,7 @@ async def on_GET( **purge.asdict(), } ] - return 200, {"results": response} + return 200, {"results": cast(JsonDict, response)} class DeleteRoomStatusByPurgeIdRestServlet(RestServlet): @@ -175,7 +175,7 @@ async def on_GET( if purge_status is None: raise NotFoundError("purge id '%s' not found" % purge_id) - return 200, purge_status.asdict() + return 200, cast(JsonDict, purge_status.asdict()) class ListRoomRestServlet(RestServlet): diff --git a/tests/rest/admin/test_room.py b/tests/rest/admin/test_room.py index 2e23000af12a..4257066b9ff8 100644 --- a/tests/rest/admin/test_room.py +++ b/tests/rest/admin/test_room.py @@ -721,7 +721,9 @@ def test_delete_same_room_twice(self): access_token=self.admin_user_tok, ) - self.assertEqual(HTTPStatus.BAD_REQUEST, second_channel.code, msg=second_channel.json_body) + self.assertEqual( + HTTPStatus.BAD_REQUEST, second_channel.code, msg=second_channel.json_body + ) self.assertEqual(Codes.UNKNOWN, second_channel.json_body["errcode"]) self.assertEqual( f"History purge already in progress for {self.room_id}", @@ -1021,9 +1023,7 @@ def _test_result( access_token=self.admin_user_tok, ) self.assertEqual( - HTTPStatus.OK, - channel_room_id.code, - msg=channel_room_id.json_body + HTTPStatus.OK, channel_room_id.code, msg=channel_room_id.json_body ) self.assertEqual(1, len(channel_room_id.json_body["results"])) self.assertEqual(purge_id, channel_room_id.json_body["results"][0]["purge_id"])