diff options
author | Erik Johnston <erik@matrix.org> | 2021-05-04 14:09:44 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2021-05-04 14:09:44 +0100 |
commit | 4a8a4830600be09bc23a7a413070dfc5fe66d509 (patch) | |
tree | 41fd0fc71eeff5d391947a47cda7b0483c39783d | |
parent | Correctly invalidate get_users_in_room_with_profiles cache (diff) | |
download | synapse-4a8a4830600be09bc23a7a413070dfc5fe66d509.tar.xz |
Fix store.get_users_in_room_with_profiles
-rw-r--r-- | synapse/storage/databases/main/roommember.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/roommember.py b/synapse/storage/databases/main/roommember.py index 2a8532f8c1..5fc3bb5a7d 100644 --- a/synapse/storage/databases/main/roommember.py +++ b/synapse/storage/databases/main/roommember.py @@ -205,8 +205,12 @@ class RoomMemberWorkerStore(EventsWorkerStore): def _get_users_in_room_with_profiles(txn) -> Dict[str, ProfileInfo]: sql = """ - SELECT user_id, display_name, avatar_url FROM room_memberships - WHERE room_id = ? AND membership = ? + SELECT state_key, display_name, avatar_url FROM room_memberships as m + INNER JOIN current_state_events as c + ON m.event_id = c.event_id + AND m.room_id = c.room_id + AND m.user_id = c.state_key + WHERE c.type = 'm.room.member' AND c.room_id = ? AND m.membership = ? """ txn.execute(sql, (room_id, Membership.JOIN)) |