Only start event streaming after having set up the controllers.

paul/schema_breaking_changes
Erik Johnston 2014-08-21 17:55:41 +01:00
parent 5670da1c1e
commit 2e1ab9db08
6 changed files with 19 additions and 5 deletions

View File

@ -15,7 +15,8 @@ for port in "8080" "8081" "8082"; do
-f "$DIR/$port.log" \ -f "$DIR/$port.log" \
-d "$DIR/$port.db" \ -d "$DIR/$port.db" \
-vv \ -vv \
-D --pid-file "$DIR/$port.pid" -D --pid-file "$DIR/$port.pid"\
-w
done done
echo "Starting webclient on port 8000..." echo "Starting webclient on port 8000..."

View File

@ -53,7 +53,7 @@ angular.module('MatrixWebClientController', ['matrixService'])
}; };
if (matrixService.isUserLoggedIn()) { if (matrixService.isUserLoggedIn()) {
eventStreamService.resume(); // eventStreamService.resume();
} }
// Logs the user out // Logs the user out

View File

@ -80,6 +80,6 @@ matrixWebClient.run(['$location', 'matrixService', 'eventStreamService', functio
$location.path("login"); $location.path("login");
} }
else { else {
eventStreamService.resume(); // eventStreamService.resume();
} }
}]); }]);

View File

@ -106,6 +106,16 @@ angular.module('eventStreamService', [])
// FIXME: We are discarding all the messages. // FIXME: We are discarding all the messages.
matrixService.rooms().then( matrixService.rooms().then(
function(response) { 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; var presence = response.data.presence;
for (var i = 0; i < presence.length; ++i) { for (var i = 0; i < presence.length; ++i) {
eventHandlerService.handleEvent(presence[i], false); eventHandlerService.handleEvent(presence[i], false);

View File

@ -328,6 +328,7 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
var chunk = response.data.chunk[i]; var chunk = response.data.chunk[i];
updateMemberList(chunk); updateMemberList(chunk);
} }
eventStreamService.resume();
}, },
function(error) { function(error) {
$scope.feedback = "Failed get member list: " + error.data.error; $scope.feedback = "Failed get member list: " + error.data.error;

View File

@ -17,8 +17,8 @@ limitations under the License.
'use strict'; 'use strict';
angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload', 'eventHandlerService']) angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload', 'eventHandlerService'])
.controller('RoomsController', ['$scope', '$location', 'matrixService', 'mFileUpload', 'eventHandlerService', .controller('RoomsController', ['$scope', '$location', 'matrixService', 'mFileUpload', 'eventHandlerService', 'eventStreamService',
function($scope, $location, matrixService, mFileUpload, eventHandlerService) { function($scope, $location, matrixService, mFileUpload, eventHandlerService, eventStreamService) {
$scope.rooms = {}; $scope.rooms = {};
$scope.public_rooms = []; $scope.public_rooms = [];
@ -113,6 +113,8 @@ angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload',
$scope.public_rooms = assignRoomAliases(response.data.chunk); $scope.public_rooms = assignRoomAliases(response.data.chunk);
} }
); );
eventStreamService.resume();
}; };
$scope.createNewRoom = function(room_id, isPrivate) { $scope.createNewRoom = function(room_id, isPrivate) {