Merge pull request #2993 from matrix-org/erikj/is_blocked
Add is_blocked to worker store
This commit is contained in:
commit
f51565e023
|
@ -157,6 +157,18 @@ class RoomWorkerStore(SQLBaseStore):
|
||||||
"get_public_room_changes", get_public_room_changes_txn
|
"get_public_room_changes", get_public_room_changes_txn
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@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",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class RoomStore(RoomWorkerStore, SearchStore):
|
class RoomStore(RoomWorkerStore, SearchStore):
|
||||||
|
|
||||||
|
@ -485,18 +497,6 @@ class RoomStore(RoomWorkerStore, SearchStore):
|
||||||
else:
|
else:
|
||||||
defer.returnValue(None)
|
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
|
@defer.inlineCallbacks
|
||||||
def block_room(self, room_id, user_id):
|
def block_room(self, room_id, user_id):
|
||||||
yield self._simple_insert(
|
yield self._simple_insert(
|
||||||
|
@ -507,7 +507,11 @@ class RoomStore(RoomWorkerStore, SearchStore):
|
||||||
},
|
},
|
||||||
desc="block_room",
|
desc="block_room",
|
||||||
)
|
)
|
||||||
self.is_room_blocked.invalidate((room_id,))
|
yield self.runInteraction(
|
||||||
|
"block_room_invalidation",
|
||||||
|
self._invalidate_cache_and_stream,
|
||||||
|
self.is_room_blocked, (room_id,),
|
||||||
|
)
|
||||||
|
|
||||||
def get_media_mxcs_in_room(self, room_id):
|
def get_media_mxcs_in_room(self, room_id):
|
||||||
"""Retrieves all the local and remote media MXC URIs in a given room
|
"""Retrieves all the local and remote media MXC URIs in a given room
|
||||||
|
|
Loading…
Reference in New Issue