Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
No need for the extra join since membership is built-in to `current…
Browse files Browse the repository at this point in the history
…_state_events` (#15731)

This helps with the upstream `is_host_joined()` and `is_host_invited()` functions.

`membership` was added to `current_state_events` in #5706 and forced in #13745
  • Loading branch information
MadLittleMods authored Jun 7, 2023
1 parent 8bfded8 commit 9d911b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/15731.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove redundant table join with `room_memberships` when doing a `is_host_joined()`/`is_host_invited()` call (`membership` is already part of the `current_state_events`).
7 changes: 3 additions & 4 deletions synapse/storage/databases/main/roommember.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,11 +927,10 @@ async def _check_host_room_membership(
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
"""
Expand Down

0 comments on commit 9d911b0

Please sign in to comment.