summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-11-09 15:20:24 +0000
committerGitHub <noreply@github.com>2017-11-09 15:20:24 +0000
commit0fcb5a8ce5e0c52b9cb2cd80ef2f737b087fadab (patch)
treeee3712f658974e07b8aa6dbe4263972b5f6e006f /synapse/storage
parentMerge pull request #2631 from xyzz/fix_appservice_event_backlog (diff)
parentAdd brackets (diff)
downloadsynapse-0fcb5a8ce5e0c52b9cb2cd80ef2f737b087fadab.tar.xz
Merge pull request #2651 from matrix-org/erikj/update_group_room_settings
Change so that update group room visibility isn't an upsert
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/group_server.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/synapse/storage/group_server.py b/synapse/storage/group_server.py
index 6b261dcc0f..6cb4ac28be 100644
--- a/synapse/storage/group_server.py
+++ b/synapse/storage/group_server.py
@@ -846,25 +846,32 @@ class GroupServerStore(SQLBaseStore):
             )
         return self.runInteraction("remove_user_from_group", _remove_user_from_group_txn)
 
-    def update_room_group_association(self, group_id, room_id, is_public):
-        return self._simple_upsert(
+    def add_room_to_group(self, group_id, room_id, is_public):
+        return self._simple_insert(
             table="group_rooms",
-            keyvalues={
+            values={
                 "group_id": group_id,
                 "room_id": room_id,
-            },
-            values={
                 "is_public": is_public,
             },
-            insertion_values={
+            desc="add_room_to_group",
+        )
+
+    def update_room_in_group_visibility(self, group_id, room_id, is_public):
+        return self._simple_update(
+            table="group_rooms",
+            keyvalues={
                 "group_id": group_id,
                 "room_id": room_id,
             },
-            desc="update_room_group_association",
+            values={
+                "is_public": is_public,
+            },
+            desc="update_room_in_group_visibility",
         )
 
-    def delete_room_group_association(self, group_id, room_id):
-        def _delete_room_group_association_txn(txn):
+    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",
@@ -883,7 +890,7 @@ class GroupServerStore(SQLBaseStore):
                 },
             )
         return self.runInteraction(
-            "delete_room_group_association", _delete_room_group_association_txn,
+            "remove_room_from_group", _remove_room_from_group_txn,
         )
 
     def get_publicised_groups_for_user(self, user_id):