summary refs log tree commit diff
path: root/webclient/room
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/room
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/room')
-rw-r--r--webclient/room/room-controller.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index c8104e39e6..c58d675760 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -479,6 +479,15 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
                             else {
                                 promise = 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;
+                                            }
+                                        );                                        
                                         $location.url("room/" + room_alias);
                                     },
                                     function(error) {
@@ -732,6 +741,16 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
                     $scope.state.waiting_for_joined_event = true;
                     matrixService.join($scope.room_id).then(
                         function() {
+                            // TODO: factor out the common housekeeping whenever we try to join a room or alias
+                            matrixService.roomState($scope.room_id).then(
+                                function(response) {
+                                    eventHandlerService.handleEvents(response, false, true);
+                                },
+                                function(error) {
+                                    console.error("Failed to get room state for: " + $scope.room_id);
+                                }
+                            );                                        
+                            
                             // onInit3 will be called once the joined m.room.member event is received from the events stream
                             // This avoids to get the joined information twice in parallel:
                             //    - one from the events stream
@@ -740,6 +759,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
                         },
                         function(reason) {
                             console.log("Can't join room: " + JSON.stringify(reason));
+                            // FIXME: what if it wasn't a perms problem?
                             $scope.state.permission_denied = "You do not have permission to join this room";
                         });
                 }