summary refs log tree commit diff
path: root/webclient/home/home-controller.js
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2014-09-23 18:50:39 +0100
committerMatthew Hodgson <matthew@matrix.org>2014-09-23 18:50:39 +0100
commit437969eac9b2a53ae916e71e2a170e639e36d6de (patch)
treefa3012154451e90ecf1e8c3c0507222e946f4679 /webclient/home/home-controller.js
parentpatch over another scenario whe we leak room IDs. i have *zero* idea why or ... (diff)
downloadsynapse-437969eac9b2a53ae916e71e2a170e639e36d6de.tar.xz
use all new /rooms/<room id>/state to actually gather the state for rooms whenever join them. a bit ugly, as we don't currently have a nice place to gather housekeeping after joining a room, so horrible code duplication...
Diffstat (limited to 'webclient/home/home-controller.js')
-rw-r--r--webclient/home/home-controller.js29
1 files changed, 22 insertions, 7 deletions
diff --git a/webclient/home/home-controller.js b/webclient/home/home-controller.js
index a535d439d3..0624a8b0e6 100644
--- a/webclient/home/home-controller.js
+++ b/webclient/home/home-controller.js
@@ -86,18 +86,24 @@ angular.module('HomeController', ['matrixService', 'eventHandlerService', 'Recen
     
     // Go to a room
     $scope.goToRoom = function(room_id) {
-        // Simply open the room page on this room id
-        //$location.url("room/" + room_id);
         matrixService.join(room_id).then(
             function(response) {
+                var final_room_id = room_id;
                 if (response.data.hasOwnProperty("room_id")) {
-                    if (response.data.room_id != room_id) {
-                        $location.url("room/" + response.data.room_id);
-                        return;
-                     }
+                    final_room_id = response.data.room_id;
                 }
 
-                $location.url("room/" + room_id);
+                // TODO: factor out the common housekeeping whenever we try to join a room or alias
+                matrixService.roomState(final_room_id).then(
+                    function(response) {
+                        eventHandlerService.handleEvents(response, false, true);
+                    },
+                    function(error) {
+                        $scope.feedback = "Failed to get room state for: " + final_room_id;
+                    }
+                );                                        
+
+                $location.url("room/" + final_room_id);
             },
             function(error) {
                 $scope.feedback = "Can't join room: " + JSON.stringify(error.data);
@@ -108,6 +114,15 @@ angular.module('HomeController', ['matrixService', 'eventHandlerService', 'Recen
     $scope.joinAlias = function(room_alias) {
         matrixService.joinAlias(room_alias).then(
             function(response) {
+                // TODO: factor out the common housekeeping whenever we try to join a room or alias
+                matrixService.roomState(response.room_id).then(
+                    function(response) {
+                        eventHandlerService.handleEvents(response, false, true);
+                    },
+                    function(error) {
+                        $scope.feedback = "Failed to get room state for: " + response.room_id;
+                    }
+                );                                        
                 // Go to this room
                 $location.url("room/" + room_alias);
             },