summary refs log tree commit diff
path: root/synapse/rest/directory.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/rest/directory.py')
-rw-r--r--synapse/rest/directory.py19
1 files changed, 5 insertions, 14 deletions
diff --git a/synapse/rest/directory.py b/synapse/rest/directory.py
index 31fd26e848..be9a3f5f9f 100644
--- a/synapse/rest/directory.py
+++ b/synapse/rest/directory.py
@@ -16,7 +16,6 @@
 
 from twisted.internet import defer
 
-from synapse.types import RoomAlias, RoomID
 from base import RestServlet, client_path_pattern
 
 import json
@@ -36,17 +35,10 @@ class ClientDirectoryServer(RestServlet):
 
     @defer.inlineCallbacks
     def on_GET(self, request, room_alias):
-        # TODO(erikj): Handle request
-        local_only = "local_only" in request.args
-
-        room_alias = urllib.unquote(room_alias)
-        room_alias_obj = RoomAlias.from_string(room_alias, self.hs)
+        room_alias = self.hs.parse_roomalias(urllib.unquote(room_alias))
 
         dir_handler = self.handlers.directory_handler
-        res = yield dir_handler.get_association(
-            room_alias_obj,
-            local_only=local_only
-        )
+        res = yield dir_handler.get_association(room_alias)
 
         defer.returnValue((200, res))
 
@@ -57,10 +49,9 @@ class ClientDirectoryServer(RestServlet):
 
         logger.debug("Got content: %s", content)
 
-        room_alias = urllib.unquote(room_alias)
-        room_alias_obj = RoomAlias.from_string(room_alias, self.hs)
+        room_alias = self.hs.parse_roomalias(urllib.unquote(room_alias))
 
-        logger.debug("Got room name: %s", room_alias_obj.to_string())
+        logger.debug("Got room name: %s", room_alias.to_string())
 
         room_id = content["room_id"]
         servers = content["servers"]
@@ -75,7 +66,7 @@ class ClientDirectoryServer(RestServlet):
 
         try:
             yield dir_handler.create_association(
-                room_alias_obj, room_id, servers
+                room_alias, room_id, servers
             )
         except:
             logger.exception("Failed to create association")