summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-21 17:55:41 +0100
committerErik Johnston <erik@matrix.org>2014-08-21 17:55:41 +0100
commit2e1ab9db08e3fe41822a65fdf38feafbd22173b6 (patch)
tree07d304a6cfd661c9c449e69da97101e47e3a8e55
parentAdd ts field to all events. (diff)
downloadsynapse-2e1ab9db08e3fe41822a65fdf38feafbd22173b6.tar.xz
Only start event streaming after having set up the controllers.
-rwxr-xr-xdemo/start.sh3
-rw-r--r--webclient/app-controller.js2
-rw-r--r--webclient/app.js2
-rw-r--r--webclient/components/matrix/event-stream-service.js10
-rw-r--r--webclient/room/room-controller.js1
-rw-r--r--webclient/rooms/rooms-controller.js6
6 files changed, 19 insertions, 5 deletions
diff --git a/demo/start.sh b/demo/start.sh
index 4701872926..fa2998a5e9 100755
--- a/demo/start.sh
+++ b/demo/start.sh
@@ -15,7 +15,8 @@ for port in "8080" "8081" "8082"; do
         -f "$DIR/$port.log" \
         -d "$DIR/$port.db" \
         -vv \
-        -D --pid-file "$DIR/$port.pid"
+        -D --pid-file "$DIR/$port.pid"\
+        -w
 done
 
 echo "Starting webclient on port 8000..."
diff --git a/webclient/app-controller.js b/webclient/app-controller.js
index 96656e12c3..c53f29aa77 100644
--- a/webclient/app-controller.js
+++ b/webclient/app-controller.js
@@ -53,7 +53,7 @@ angular.module('MatrixWebClientController', ['matrixService'])
     };
 
     if (matrixService.isUserLoggedIn()) {
-        eventStreamService.resume();
+        // eventStreamService.resume();
     }
     
     // Logs the user out 
diff --git a/webclient/app.js b/webclient/app.js
index f27ebedc6f..944b8ec270 100644
--- a/webclient/app.js
+++ b/webclient/app.js
@@ -80,6 +80,6 @@ matrixWebClient.run(['$location', 'matrixService', 'eventStreamService', functio
         $location.path("login");
     }
     else {
-        eventStreamService.resume();
+        // eventStreamService.resume();
     }
 }]);
diff --git a/webclient/components/matrix/event-stream-service.js b/webclient/components/matrix/event-stream-service.js
index 9a8f6eac4c..a1a98b2a36 100644
--- a/webclient/components/matrix/event-stream-service.js
+++ b/webclient/components/matrix/event-stream-service.js
@@ -106,6 +106,16 @@ angular.module('eventStreamService', [])
         // FIXME: We are discarding all the messages.
         matrixService.rooms().then(
             function(response) {
+                var rooms = response.data.rooms;
+                for (var i = 0; i < rooms.length; ++i) {
+                    var room = rooms[i];
+                    if ("state" in room) {
+                        for (var j = 0; j < room.state.length; ++j) {
+                            eventHandlerService.handleEvents(room.state[j], false);
+                        }
+                    }
+                }
+
                 var presence = response.data.presence;
                 for (var i = 0; i < presence.length; ++i) {
                     eventHandlerService.handleEvent(presence[i], false);
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index eee805dafb..214166a434 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -328,6 +328,7 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
                             var chunk = response.data.chunk[i];
                             updateMemberList(chunk);
                         }
+                        eventStreamService.resume();
                     },
                     function(error) {
                         $scope.feedback = "Failed get member list: " + error.data.error;
diff --git a/webclient/rooms/rooms-controller.js b/webclient/rooms/rooms-controller.js
index 6bbb2b2ba1..c2d7bcb6f3 100644
--- a/webclient/rooms/rooms-controller.js
+++ b/webclient/rooms/rooms-controller.js
@@ -17,8 +17,8 @@ limitations under the License.
 'use strict';
 
 angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload', 'eventHandlerService'])
-.controller('RoomsController', ['$scope', '$location', 'matrixService', 'mFileUpload', 'eventHandlerService',
-                               function($scope, $location, matrixService, mFileUpload, eventHandlerService) {
+.controller('RoomsController', ['$scope', '$location', 'matrixService', 'mFileUpload', 'eventHandlerService', 'eventStreamService', 
+                               function($scope, $location, matrixService, mFileUpload, eventHandlerService, eventStreamService) {
                                    
     $scope.rooms = {};
     $scope.public_rooms = [];
@@ -113,6 +113,8 @@ angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload',
                 $scope.public_rooms = assignRoomAliases(response.data.chunk);
             }
         );
+
+        eventStreamService.resume();
     };
     
     $scope.createNewRoom = function(room_id, isPrivate) {