diff options
author | Erik Johnston <erik@matrix.org> | 2017-05-31 15:11:36 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-05-31 15:11:36 +0100 |
commit | 350622a107c356da630eba09b63ed4b6de94b198 (patch) | |
tree | bfb6628b2b4271461a2a93c23ceaa1e45322defd /synapse/storage | |
parent | Add comments (diff) | |
download | synapse-350622a107c356da630eba09b63ed4b6de94b198.tar.xz |
Handle the server leaving a public room
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/schema/delta/42/user_dir.py | 4 | ||||
-rw-r--r-- | synapse/storage/user_directory.py | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/synapse/storage/schema/delta/42/user_dir.py b/synapse/storage/schema/delta/42/user_dir.py index 57b89ba552..95a7a79fd3 100644 --- a/synapse/storage/schema/delta/42/user_dir.py +++ b/synapse/storage/schema/delta/42/user_dir.py @@ -41,6 +41,7 @@ CREATE TABLE user_directory ( ); CREATE INDEX user_directory_fts_idx ON user_directory USING gin(vector); +CREATE INDEX user_directory_room_idx ON user_directory(room_id); CREATE INDEX user_directory_user_idx ON user_directory(user_id); """ @@ -48,6 +49,9 @@ CREATE INDEX user_directory_user_idx ON user_directory(user_id); SQLITE_TABLE = """ CREATE VIRTUAL TABLE user_directory USING fts4 ( user_id, room_id, display_name, avatar_url, value ); + +CREATE INDEX user_directory_room_idx ON user_directory(room_id); +CREATE INDEX user_directory_user_idx ON user_directory(user_id); """ diff --git a/synapse/storage/user_directory.py b/synapse/storage/user_directory.py index 83812bf092..0df979cb01 100644 --- a/synapse/storage/user_directory.py +++ b/synapse/storage/user_directory.py @@ -124,6 +124,17 @@ class UserDirectoryStore(SQLBaseStore): ) self.get_user_in_directory.invalidate((user_id,)) + def get_users_in_dir_due_to_room(self, room_id): + """Get all user_ids that are in the room directory becuase they're + in the given room_id + """ + return self._simple_select_onecol( + table="user_directory", + keyvalues={"room_id": room_id}, + retcol="user_id", + desc="get_users_in_dir_due_to_room", + ) + def get_all_rooms(self): """Get all room_ids we've ever known about """ |