summary refs log tree commit diff
path: root/synapse/storage/group_server.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-09-26 15:52:41 +0100
committerErik Johnston <erik@matrix.org>2017-09-26 15:52:41 +0100
commit17b8e2bd02ad0abbd25103b637eb8490f3a53507 (patch)
tree889b3b1cbfc30181fe7c9e67e122d3c0f1cc5d03 /synapse/storage/group_server.py
parentAdd unique index to group_rooms table (diff)
downloadsynapse-17b8e2bd02ad0abbd25103b637eb8490f3a53507.tar.xz
Add remove room API
Diffstat (limited to 'synapse/storage/group_server.py')
-rw-r--r--synapse/storage/group_server.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/synapse/storage/group_server.py b/synapse/storage/group_server.py
index d0b5ad231a..4fe9172adc 100644
--- a/synapse/storage/group_server.py
+++ b/synapse/storage/group_server.py
@@ -843,6 +843,29 @@ class GroupServerStore(SQLBaseStore):
             desc="add_room_to_group",
         )
 
+    def remove_room_from_group(self, group_id, room_id):
+        def _remove_room_from_group_txn(txn):
+            self._simple_delete_txn(
+                txn,
+                table="group_rooms",
+                keyvalues={
+                    "group_id": group_id,
+                    "room_id": room_id,
+                },
+            )
+
+            self._simple_delete_txn(
+                txn,
+                table="group_summary_rooms",
+                keyvalues={
+                    "group_id": group_id,
+                    "room_id": room_id,
+                },
+            )
+        return self.runInteraction(
+            "remove_room_from_group", _remove_room_from_group_txn,
+        )
+
     def get_publicised_groups_for_user(self, user_id):
         """Get all groups a user is publicising
         """