summary refs log tree commit diff
path: root/synapse/storage/data_stores/main/room.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-24 13:25:08 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-24 13:25:08 +0000
commit06d54f9f8c1044e35331eeeba98f4c454abfcae3 (patch)
tree04d5ca2f3d989c165f2607d76a49274602216436 /synapse/storage/data_stores/main/room.py
parentCast a coroutine into a Deferred in the federation base (#6996) (diff)
parentStore room version on invite (#6983) (diff)
downloadsynapse-06d54f9f8c1044e35331eeeba98f4c454abfcae3.tar.xz
Store room version on invite (#6983)
* commit '3e99528f2':
  Store room version on invite (#6983)
Diffstat (limited to 'synapse/storage/data_stores/main/room.py')
-rw-r--r--synapse/storage/data_stores/main/room.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/synapse/storage/data_stores/main/room.py b/synapse/storage/data_stores/main/room.py

index 009ad8c038..511316938d 100644 --- a/synapse/storage/data_stores/main/room.py +++ b/synapse/storage/data_stores/main/room.py
@@ -1043,6 +1043,26 @@ class RoomStore(RoomBackgroundUpdateStore, RoomWorkerStore, SearchStore): logger.error("store_room with room_id=%s failed: %s", room_id, e) raise StoreError(500, "Problem creating room.") + async def maybe_store_room_on_invite(self, room_id: str, room_version: RoomVersion): + """ + When we receive an invite over federation, store the version of the room if we + don't already know the room version. + """ + await self.db.simple_upsert( + desc="maybe_store_room_on_invite", + table="rooms", + keyvalues={"room_id": room_id}, + values={}, + insertion_values={ + "room_version": room_version.identifier, + "is_public": False, + "creator": "", + }, + # rooms has a unique constraint on room_id, so no need to lock when doing an + # emulated upsert. + lock=False, + ) + @defer.inlineCallbacks def set_room_is_public(self, room_id, is_public): def set_room_is_public_txn(txn, next_id):