summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2023-06-06 22:19:57 -0500
committerGitHub <noreply@github.com>2023-06-06 22:19:57 -0500
commit9d911b0da651893e0b67cb3506e18582cb0d95b5 (patch)
tree9972bb7c93ccdcb04676035babcbadbe230d961b /synapse
parentTrace functions which return `Awaitable` (#15650) (diff)
downloadsynapse-9d911b0da651893e0b67cb3506e18582cb0d95b5.tar.xz
No need for the extra join since `membership` is built-in to `current_state_events` (#15731)
This helps with the upstream `is_host_joined()` and `is_host_invited()` functions.

`membership` was added to `current_state_events` in https://github.com/matrix-org/synapse/pull/5706 and forced in https://github.com/matrix-org/synapse/pull/13745
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/databases/main/roommember.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/synapse/storage/databases/main/roommember.py b/synapse/storage/databases/main/roommember.py
index ae9c201b87..1b8ec67f54 100644
--- a/synapse/storage/databases/main/roommember.py
+++ b/synapse/storage/databases/main/roommember.py
@@ -927,11 +927,10 @@ class RoomMemberWorkerStore(EventsWorkerStore, CacheInvalidationWorkerStore):
             raise Exception("Invalid host name")
 
         sql = """
-            SELECT state_key FROM current_state_events AS c
-            INNER JOIN room_memberships AS m USING (event_id)
-            WHERE m.membership = ?
+            SELECT state_key FROM current_state_events
+            WHERE membership = ?
                 AND type = 'm.room.member'
-                AND c.room_id = ?
+                AND room_id = ?
                 AND state_key LIKE ?
             LIMIT 1
         """