Skip to content

Commit

Permalink
make compatible with matrix-org#11228
Browse files Browse the repository at this point in the history
  • Loading branch information
dklimpel committed Nov 9, 2021
1 parent 383d808 commit 05dd106
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
11 changes: 6 additions & 5 deletions docs/admin_api/rooms.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions synapse/rest/admin/rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ async def on_GET(
**purge.asdict(),
}
]
return 200, {"results": response}
return 200, {"results": cast(JsonDict, response)}


class DeleteRoomStatusByPurgeIdRestServlet(RestServlet):
Expand All @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions tests/rest/admin/test_room.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down Expand Up @@ -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"])
Expand Down

0 comments on commit 05dd106

Please sign in to comment.