diff options
author | Mathieu Velten <mathieuv@matrix.org> | 2023-06-26 17:07:53 +0200 |
---|---|---|
committer | Mathieu Velten <mathieuv@matrix.org> | 2023-06-30 15:58:11 +0200 |
commit | 5bce6397aa477f55a2eb89a44ee449bdc486f8c4 (patch) | |
tree | f9d38d81f56de6d4e2ea89b65343d891250aee45 /synapse/rest/admin/rooms.py | |
parent | comments (diff) | |
download | synapse-5bce6397aa477f55a2eb89a44ee449bdc486f8c4.tar.xz |
Use DB for all purge/shutdown actions, including purge history
Diffstat (limited to 'synapse/rest/admin/rooms.py')
-rw-r--r-- | synapse/rest/admin/rooms.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/synapse/rest/admin/rooms.py b/synapse/rest/admin/rooms.py index 5e4b0b4759..ed54c8bb64 100644 --- a/synapse/rest/admin/rooms.py +++ b/synapse/rest/admin/rooms.py @@ -154,20 +154,14 @@ class DeleteRoomStatusByRoomIdRestServlet(RestServlet): HTTPStatus.BAD_REQUEST, "%s is not a legal room ID" % (room_id,) ) - delete_ids = self._pagination_handler.get_delete_ids_by_room(room_id) - if delete_ids is None: - delete_ids = [] + delete_statuses = await self._pagination_handler.get_delete_statuses_by_room( + room_id + ) response = [] - for delete_id in delete_ids: - delete = self._pagination_handler.get_delete_status(delete_id) - if delete and delete.status != DeleteStatus.STATUS_SCHEDULED_PURGE: - response += [ - { - "delete_id": delete_id, - **delete.asdict(), - } - ] + for delete_status in delete_statuses: + if delete_status.status != DeleteStatus.STATUS_SCHEDULED: + response += [delete_status.asdict()] if response: return HTTPStatus.OK, {"results": cast(JsonDict, response)} @@ -189,7 +183,7 @@ class DeleteRoomStatusByDeleteIdRestServlet(RestServlet): ) -> Tuple[int, JsonDict]: await assert_requester_is_admin(self._auth, request) - delete_status = self._pagination_handler.get_delete_status(delete_id) + delete_status = await self._pagination_handler.get_delete_status(delete_id) if delete_status is None: raise NotFoundError("delete id '%s' not found" % delete_id) |