summary refs log tree commit diff
path: root/webclient/rooms/rooms-controller.js
diff options
context:
space:
mode:
authorErik Johnston <erikj@matrix.org>2014-08-12 17:17:10 +0100
committerErik Johnston <erikj@matrix.org>2014-08-12 17:17:14 +0100
commitfe3c5a27268d207e29be214c795da9bb756edb86 (patch)
treef0d7c312f7cf13c220974bfb0d50423b9411bbdb /webclient/rooms/rooms-controller.js
parentJust say yes to OPTIONS requests, since we want to turn on CORS headers for a... (diff)
downloadsynapse-fe3c5a27268d207e29be214c795da9bb756edb86.tar.xz
Fix the 'Go to room' button to use the correct room alias api
Diffstat (limited to 'webclient/rooms/rooms-controller.js')
-rw-r--r--webclient/rooms/rooms-controller.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/webclient/rooms/rooms-controller.js b/webclient/rooms/rooms-controller.js
index 58420e0eb2..33912d63f9 100644
--- a/webclient/rooms/rooms-controller.js
+++ b/webclient/rooms/rooms-controller.js
@@ -18,6 +18,10 @@ angular.module('RoomsController', ['matrixService'])
         room_id: "",
     };
 
+    $scope.joinAlias = {
+        room_alias: "",
+    };
+
     $scope.newProfileInfo = {
         name: matrixService.config().displayName,
         avatar: matrixService.config().avatarUrl
@@ -106,6 +110,22 @@ angular.module('RoomsController', ['matrixService'])
         );
     };
 
+    $scope.joinAlias = function(room_alias) {
+        matrixService.joinAlias(room_alias).then(
+            function(response) {
+                if (response.hasOwnProperty("room_id")) {
+                    $location.path("room/" + response.room_id);
+                    return;
+                } else {
+                    // TODO (erikj): Do something here?
+                }
+            },
+            function(reason) {
+                $scope.feedback = "Can't join room: " + reason;
+            }
+        );
+    };
+
     $scope.setDisplayName = function(newName) {
         matrixService.setDisplayName(newName).then(
             function(response) {