Include room ID in room deletion status response (#18318)
When querying by `delete_id` it's handy to see which room the delete pertains to.
This commit is contained in:
parent
99cbd33630
commit
553e124f76
1
changelog.d/18318.feature
Normal file
1
changelog.d/18318.feature
Normal file
@ -0,0 +1 @@
|
||||
Include room ID in room deletion status response.
|
||||
@ -794,6 +794,7 @@ A response body like the following is returned:
|
||||
"results": [
|
||||
{
|
||||
"delete_id": "delete_id1",
|
||||
"room_id": "!roomid:example.com",
|
||||
"status": "failed",
|
||||
"error": "error message",
|
||||
"shutdown_room": {
|
||||
@ -804,6 +805,7 @@ A response body like the following is returned:
|
||||
}
|
||||
}, {
|
||||
"delete_id": "delete_id2",
|
||||
"room_id": "!roomid:example.com",
|
||||
"status": "purging",
|
||||
"shutdown_room": {
|
||||
"kicked_users": [
|
||||
@ -842,6 +844,8 @@ A response body like the following is returned:
|
||||
```json
|
||||
{
|
||||
"status": "purging",
|
||||
"delete_id": "bHkCNQpHqOaFhPtK",
|
||||
"room_id": "!roomid:example.com",
|
||||
"shutdown_room": {
|
||||
"kicked_users": [
|
||||
"@foobar:example.com"
|
||||
@ -869,7 +873,8 @@ The following fields are returned in the JSON response body:
|
||||
- `results` - An array of objects, each containing information about one task.
|
||||
This field is omitted from the result when you query by `delete_id`.
|
||||
Task objects contain the following fields:
|
||||
- `delete_id` - The ID for this purge if you query by `room_id`.
|
||||
- `delete_id` - The ID for this purge
|
||||
- `room_id` - The ID of the room being deleted
|
||||
- `status` - The status will be one of:
|
||||
- `shutting_down` - The process is removing users from the room.
|
||||
- `purging` - The process is purging the room and event data from database.
|
||||
|
||||
@ -150,6 +150,7 @@ class RoomRestV2Servlet(RestServlet):
|
||||
def _convert_delete_task_to_response(task: ScheduledTask) -> JsonDict:
|
||||
return {
|
||||
"delete_id": task.id,
|
||||
"room_id": task.resource_id,
|
||||
"status": task.status,
|
||||
"shutdown_room": task.result,
|
||||
}
|
||||
|
||||
@ -758,6 +758,8 @@ class DeleteRoomV2TestCase(unittest.HomeserverTestCase):
|
||||
self.assertEqual(2, len(channel.json_body["results"]))
|
||||
self.assertEqual("complete", channel.json_body["results"][0]["status"])
|
||||
self.assertEqual("complete", channel.json_body["results"][1]["status"])
|
||||
self.assertEqual(self.room_id, channel.json_body["results"][0]["room_id"])
|
||||
self.assertEqual(self.room_id, channel.json_body["results"][1]["room_id"])
|
||||
delete_ids = {delete_id1, delete_id2}
|
||||
self.assertTrue(channel.json_body["results"][0]["delete_id"] in delete_ids)
|
||||
delete_ids.remove(channel.json_body["results"][0]["delete_id"])
|
||||
@ -777,6 +779,7 @@ class DeleteRoomV2TestCase(unittest.HomeserverTestCase):
|
||||
self.assertEqual(1, len(channel.json_body["results"]))
|
||||
self.assertEqual("complete", channel.json_body["results"][0]["status"])
|
||||
self.assertEqual(delete_id2, channel.json_body["results"][0]["delete_id"])
|
||||
self.assertEqual(self.room_id, channel.json_body["results"][0]["room_id"])
|
||||
|
||||
# get status after more than clearing time for all tasks
|
||||
self.reactor.advance(TaskScheduler.KEEP_TASKS_FOR_MS / 1000 / 2)
|
||||
@ -1237,6 +1240,9 @@ class DeleteRoomV2TestCase(unittest.HomeserverTestCase):
|
||||
self.assertEqual(
|
||||
delete_id, channel_room_id.json_body["results"][0]["delete_id"]
|
||||
)
|
||||
self.assertEqual(
|
||||
self.room_id, channel_room_id.json_body["results"][0]["room_id"]
|
||||
)
|
||||
|
||||
# get information by delete_id
|
||||
channel_delete_id = self.make_request(
|
||||
@ -1249,6 +1255,7 @@ class DeleteRoomV2TestCase(unittest.HomeserverTestCase):
|
||||
channel_delete_id.code,
|
||||
msg=channel_delete_id.json_body,
|
||||
)
|
||||
self.assertEqual(self.room_id, channel_delete_id.json_body["room_id"])
|
||||
|
||||
# test values that are the same in both responses
|
||||
for content in [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user