diff options
author | Erik Johnston <erik@matrix.org> | 2014-09-03 16:04:21 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-09-03 16:04:27 +0100 |
commit | 30bcbc433a4d59ddd0e8c3a268c9d3ce668c74c2 (patch) | |
tree | ced5e38adc9600ffe25cf2f9c57de40867f11f38 /synapse/handlers/directory.py | |
parent | List commands and their usage in the settings page (diff) | |
download | synapse-30bcbc433a4d59ddd0e8c3a268c9d3ce668c74c2.tar.xz |
Fix up directory server to not require uploading room hosts. Update the room hosts table with the current room hosts (if we have them) on GET.
Diffstat (limited to 'synapse/handlers/directory.py')
-rw-r--r-- | synapse/handlers/directory.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py index 2e9c6b688b..22aab9b0a8 100644 --- a/synapse/handlers/directory.py +++ b/synapse/handlers/directory.py @@ -37,7 +37,7 @@ class DirectoryHandler(BaseHandler): ) @defer.inlineCallbacks - def create_association(self, room_alias, room_id, servers): + def create_association(self, room_alias, room_id, servers=None): # TODO(erikj): Do auth. if not room_alias.is_mine: @@ -48,6 +48,12 @@ class DirectoryHandler(BaseHandler): # TODO(erikj): Check if there is a current association. + if not servers: + servers = yield self.store.get_joined_hosts_for_room(room_id) + + if not servers: + raise SynapseError(400, "Failed to get server list") + yield self.store.create_room_alias_association( room_alias, room_id, @@ -83,6 +89,9 @@ class DirectoryHandler(BaseHandler): defer.returnValue({}) return + extra_servers = yield self.store.get_joined_hosts_for_room(room_id) + servers = list(set(extra_servers) | set(servers)) + defer.returnValue({ "room_id": room_id, "servers": servers, |