diff options
author | Erik Johnston <erikj@jki.re> | 2017-06-19 16:20:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-19 16:20:55 +0100 |
commit | b5f665de3209aa77ac9f692a515e4f96444b9003 (patch) | |
tree | dfa58ac75e65b503472bc603a9601bc0295a02b7 /synapse/storage/room.py | |
parent | add missing boolean to synapse_port_db (diff) | |
parent | Handle all cases of sending membership events (diff) | |
download | synapse-b5f665de3209aa77ac9f692a515e4f96444b9003.tar.xz |
Merge pull request #2291 from matrix-org/erikj/shutdown_room
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,)) |