diff options
author | Erik Johnston <erik@matrix.org> | 2017-06-19 12:36:28 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-06-19 12:37:27 +0100 |
commit | d7fe6b356c5b74ffc5681f85a0d6100f4b4f2295 (patch) | |
tree | d5695155a2dc3779be156bef18445a102660c6e3 /synapse/storage/room.py | |
parent | add missing boolean to synapse_port_db (diff) | |
download | synapse-d7fe6b356c5b74ffc5681f85a0d6100f4b4f2295.tar.xz |
Add shutdown room API
Diffstat (limited to 'synapse/storage/room.py')
-rw-r--r-- | synapse/storage/room.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/synapse/storage/room.py b/synapse/storage/room.py index 5d543652bb..07366f66b6 100644 --- a/synapse/storage/room.py +++ b/synapse/storage/room.py @@ -507,3 +507,27 @@ class RoomStore(SQLBaseStore): )) else: defer.returnValue(None) + + @cached(max_entries=10000) + def is_room_blocked(self, room_id): + return self._simple_select_one_onecol( + table="blocked_rooms", + keyvalues={ + "room_id": room_id, + }, + retcol="1", + allow_none=True, + desc="is_room_blocked", + ) + + @defer.inlineCallbacks + def block_room(self, room_id, user_id): + yield self._simple_insert( + table="blocked_rooms", + values={ + "room_id": room_id, + "user_id": user_id, + }, + desc="block_room", + ) + self.is_room_blocked.invalidate((room_id,)) |