From 5a447098dd8442c7c69b2db22d42e6ce40c2dc6e Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 24 Mar 2015 16:19:24 +0000 Subject: [PATCH] Don't use room hosts table --- synapse/storage/roommember.py | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index a22950520..df707f812 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -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) def get_room_member(self, user_id, room_id): @@ -229,11 +209,10 @@ class RoomMemberStore(SQLBaseStore): where_values.append(user_id) sql = ( - "SELECT m.* FROM room_memberships as m " - "ON e.event_id = m.event_id " - "INNER JOIN current_state_events as c " - "ON m.event_id = c.event_id " - "WHERE %(where)s " + "SELECT m.* FROM room_memberships as m" + " INNER JOIN current_state_events as c" + " ON m.event_id = c.event_id" + " WHERE %(where)s" ) % { "where": where_clause, }