mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-24 12:09:21 -05:00
More accurate docs / clearer paramter names in RoomMemberStore
This commit is contained in:
parent
a87eac4308
commit
aa525e4a63
@ -120,7 +120,7 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
membership_list (list): A list of synapse.api.constants.Membership
|
membership_list (list): A list of synapse.api.constants.Membership
|
||||||
values which the user must be in.
|
values which the user must be in.
|
||||||
Returns:
|
Returns:
|
||||||
A list of dicts with "room_id" and "membership" keys.
|
A list of RoomMemberEvent objects
|
||||||
"""
|
"""
|
||||||
if not membership_list:
|
if not membership_list:
|
||||||
return defer.succeed(None)
|
return defer.succeed(None)
|
||||||
@ -165,10 +165,11 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
defer.returnValue(results)
|
defer.returnValue(results)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def user_rooms_intersect(self, user_list):
|
def user_rooms_intersect(self, user_id_list):
|
||||||
""" Checks whether a list of users share a room.
|
""" Checks whether all the users whose IDs are given in a list share a
|
||||||
|
room.
|
||||||
"""
|
"""
|
||||||
user_list_clause = " OR ".join(["m.user_id = ?"] * len(user_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 "
|
||||||
"INNER JOIN current_state_events as c "
|
"INNER JOIN current_state_events as c "
|
||||||
@ -178,8 +179,8 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
"GROUP BY m.room_id HAVING COUNT(m.room_id) = ?"
|
"GROUP BY m.room_id HAVING COUNT(m.room_id) = ?"
|
||||||
) % {"clause": user_list_clause}
|
) % {"clause": user_list_clause}
|
||||||
|
|
||||||
args = user_list
|
args = list(user_id_list)
|
||||||
args.append(len(user_list))
|
args.append(len(user_id_list))
|
||||||
|
|
||||||
rows = yield self._execute(None, sql, *args)
|
rows = yield self._execute(None, sql, *args)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user