summary refs log tree commit diff
path: root/synapse/storage/room.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-03-21 11:24:42 +0000
committerGitHub <noreply@github.com>2019-03-21 11:24:42 +0000
commit3959858eaa517efade0f95bd33d32a907c0983ca (patch)
treef8d63cdc5f7f2098e1a8ec5b9786d1c426b5247d /synapse/storage/room.py
parentMerge pull request #4896 from matrix-org/erikj/disable_room_directory (diff)
parentFix typo and add description (diff)
downloadsynapse-3959858eaa517efade0f95bd33d32a907c0983ca.tar.xz
Merge pull request #4904 from matrix-org/erikj/fix_shutdown
Fixup shutdown room API
Diffstat (limited to 'synapse/storage/room.py')
-rw-r--r--synapse/storage/room.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/synapse/storage/room.py b/synapse/storage/room.py
index 41c65e112a..a979d4860a 100644
--- a/synapse/storage/room.py
+++ b/synapse/storage/room.py
@@ -500,10 +500,22 @@ class RoomStore(RoomWorkerStore, SearchStore):
 
     @defer.inlineCallbacks
     def block_room(self, room_id, user_id):
-        yield self._simple_insert(
+        """Marks the room as blocked. Can be called multiple times.
+
+        Args:
+            room_id (str): Room to block
+            user_id (str): Who blocked it
+
+        Returns:
+            Deferred
+        """
+        yield self._simple_upsert(
             table="blocked_rooms",
-            values={
+            keyvalues={
                 "room_id": room_id,
+            },
+            values={},
+            insertion_values={
                 "user_id": user_id,
             },
             desc="block_room",