summary refs log tree commit diff
path: root/synapse/storage/directory.py
diff options
context:
space:
mode:
authorKrombel <krombel@krombel.de>2017-06-21 14:48:21 +0200
committerKrombel <krombel@krombel.de>2017-06-21 14:48:21 +0200
commit4202fba82a255eb52783a91d873b91aa8ef2191c (patch)
tree73975e960b5a80f7a466cbf62810639662093d4a /synapse/storage/directory.py
parentreplaced json.dumps with encode_canonical_json (diff)
parentMerge pull request #2292 from matrix-org/erikj/quarantine_media (diff)
downloadsynapse-4202fba82a255eb52783a91d873b91aa8ef2191c.tar.xz
Merge branch 'develop' into avoid_duplicate_filters
Diffstat (limited to 'synapse/storage/directory.py')
-rw-r--r--synapse/storage/directory.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/storage/directory.py b/synapse/storage/directory.py
index 9caaf81f2c..79e7c540ad 100644
--- a/synapse/storage/directory.py
+++ b/synapse/storage/directory.py
@@ -170,3 +170,17 @@ class DirectoryStore(SQLBaseStore):
             "room_alias",
             desc="get_aliases_for_room",
         )
+
+    def update_aliases_for_room(self, old_room_id, new_room_id, creator):
+        def _update_aliases_for_room_txn(txn):
+            sql = "UPDATE room_aliases SET room_id = ?, creator = ? WHERE room_id = ?"
+            txn.execute(sql, (new_room_id, creator, old_room_id,))
+            self._invalidate_cache_and_stream(
+                txn, self.get_aliases_for_room, (old_room_id,)
+            )
+            self._invalidate_cache_and_stream(
+                txn, self.get_aliases_for_room, (new_room_id,)
+            )
+        return self.runInteraction(
+            "_update_aliases_for_room_txn", _update_aliases_for_room_txn
+        )