mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-25 11:45:30 +00:00
Don't use room hosts table
This commit is contained in:
parent
9e98f1022a
commit
5a447098dd
@ -65,26 +65,6 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Update room hosts table
|
|
||||||
if event.membership == Membership.JOIN:
|
|
||||||
sql = (
|
|
||||||
"REPLACE INTO room_hosts (room_id, host) "
|
|
||||||
"VALUES (?, ?)"
|
|
||||||
)
|
|
||||||
txn.execute(sql, (event.room_id, domain))
|
|
||||||
elif event.membership != Membership.INVITE:
|
|
||||||
# Check if this was the last person to have left.
|
|
||||||
joined_domains = self._get_joined_hosts_for_room_txn(
|
|
||||||
txn, event.room_id
|
|
||||||
)
|
|
||||||
|
|
||||||
if domain not in joined_domains:
|
|
||||||
sql = (
|
|
||||||
"DELETE FROM room_hosts WHERE room_id = ? AND host = ?"
|
|
||||||
)
|
|
||||||
|
|
||||||
txn.execute(sql, (event.room_id, domain))
|
|
||||||
|
|
||||||
self.get_rooms_for_user.invalidate(target_user_id)
|
self.get_rooms_for_user.invalidate(target_user_id)
|
||||||
|
|
||||||
def get_room_member(self, user_id, room_id):
|
def get_room_member(self, user_id, room_id):
|
||||||
@ -229,11 +209,10 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
where_values.append(user_id)
|
where_values.append(user_id)
|
||||||
|
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT m.* FROM room_memberships as m "
|
"SELECT m.* FROM room_memberships as m"
|
||||||
"ON e.event_id = m.event_id "
|
" INNER JOIN current_state_events as c"
|
||||||
"INNER JOIN current_state_events as c "
|
" ON m.event_id = c.event_id"
|
||||||
"ON m.event_id = c.event_id "
|
" WHERE %(where)s"
|
||||||
"WHERE %(where)s "
|
|
||||||
) % {
|
) % {
|
||||||
"where": where_clause,
|
"where": where_clause,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user