summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-11-30 16:48:12 +0000
committerGitHub <noreply@github.com>2020-11-30 16:48:12 +0000
commita090b86209c01e42415df7736eb26c8adbe2aba0 (patch)
treeaa750ab41d37c5a338769aebaba58b870ad59bb3 /synapse/handlers
parentRemove special case of pretty printing JSON responses for curl (#8833) (diff)
downloadsynapse-a090b86209c01e42415df7736eb26c8adbe2aba0.tar.xz
Add `force_purge` option to delete-room admin api. (#8843)
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/pagination.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/synapse/handlers/pagination.py b/synapse/handlers/pagination.py
index 426b58da9e..5372753707 100644
--- a/synapse/handlers/pagination.py
+++ b/synapse/handlers/pagination.py
@@ -299,17 +299,22 @@ class PaginationHandler:
         """
         return self._purges_by_id.get(purge_id)
 
-    async def purge_room(self, room_id: str) -> None:
-        """Purge the given room from the database"""
+    async def purge_room(self, room_id: str, force: bool = False) -> None:
+        """Purge the given room from the database.
+
+        Args:
+            room_id: room to be purged
+            force: set true to skip checking for joined users.
+        """
         with await self.pagination_lock.write(room_id):
             # check we know about the room
             await self.store.get_room_version_id(room_id)
 
             # first check that we have no users in this room
-            joined = await self.store.is_host_joined(room_id, self._server_name)
-
-            if joined:
-                raise SynapseError(400, "Users are still joined to this room")
+            if not force:
+                joined = await self.store.is_host_joined(room_id, self._server_name)
+                if joined:
+                    raise SynapseError(400, "Users are still joined to this room")
 
             await self.storage.purge_events.purge_room(room_id)