mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-19 03:44:18 -05:00
Name 'user_rooms_intersect' transaction
This commit is contained in:
parent
76ec154e95
commit
96707ed718
@ -239,11 +239,11 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
results = self._parse_events_txn(txn, rows)
|
results = self._parse_events_txn(txn, rows)
|
||||||
return results
|
return results
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
|
||||||
def user_rooms_intersect(self, user_id_list):
|
def user_rooms_intersect(self, user_id_list):
|
||||||
""" Checks whether all the users whose IDs are given in a list share a
|
""" Checks whether all the users whose IDs are given in a list share a
|
||||||
room.
|
room.
|
||||||
"""
|
"""
|
||||||
|
def interaction(txn):
|
||||||
user_list_clause = " OR ".join(["m.user_id = ?"] * len(user_id_list))
|
user_list_clause = " OR ".join(["m.user_id = ?"] * len(user_id_list))
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT m.room_id FROM room_memberships as m "
|
"SELECT m.room_id FROM room_memberships as m "
|
||||||
@ -259,6 +259,8 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
args = list(user_id_list)
|
args = list(user_id_list)
|
||||||
args.append(len(user_id_list))
|
args.append(len(user_id_list))
|
||||||
|
|
||||||
rows = yield self._execute(None, sql, *args)
|
txn.execute(sql, args)
|
||||||
|
|
||||||
defer.returnValue(len(rows) > 0)
|
return len(txn.fetchall()) > 0
|
||||||
|
|
||||||
|
return self.runInteraction("user_rooms_intersect", interaction)
|
||||||
|
Loading…
Reference in New Issue
Block a user