mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:16:09 -04:00
Add RoomMemberStore.get_users_in_room, so that we can get the list of joined users without having to retrieve the full events
This commit is contained in:
parent
96a5ba41f5
commit
f0128f9600
2 changed files with 18 additions and 8 deletions
|
@ -123,6 +123,19 @@ class RoomMemberStore(SQLBaseStore):
|
|||
else:
|
||||
return None
|
||||
|
||||
def get_users_in_room(self, room_id):
|
||||
def f(txn):
|
||||
sql = (
|
||||
"SELECT m.user_id FROM room_memberships as m"
|
||||
" INNER JOIN current_state_events as c"
|
||||
" ON m.event_id = c.event_id"
|
||||
" WHERE m.membership = ? AND m.room_id = ?"
|
||||
)
|
||||
|
||||
txn.execute(sql, (Membership.JOIN, room_id))
|
||||
return [r[0] for r in txn.fetchall()]
|
||||
return self.runInteraction("get_users_in_room", f)
|
||||
|
||||
def get_room_members(self, room_id, membership=None):
|
||||
"""Retrieve the current room member list for a room.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue