summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/storage/roommember.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py
index 447c6364e7..e38bbd22a3 100644
--- a/synapse/storage/roommember.py
+++ b/synapse/storage/roommember.py
@@ -507,9 +507,12 @@ class RoomMemberStore(SQLBaseStore):
             raise Exception("Invalid host name")
 
         sql = """
-            SELECT state_key FROM current_state_events
-            INNER JOIN room_memberships USING (room_id, event_id)
-            WHERE membership = 'join' AND room_id = ? AND state_key LIKE ?
+            SELECT state_key FROM current_state_events AS c
+            INNER JOIN room_memberships USING (event_id)
+            WHERE membership = 'join'
+                AND type = 'm.room.member'
+                AND c.room_id = ?
+                AND state_key LIKE ?
             LIMIT 1
         """