summary refs log tree commit diff
path: root/webclient
diff options
context:
space:
mode:
authorDavid Baker <dbkr@matrix.org>2014-09-11 17:40:38 +0100
committerDavid Baker <dbkr@matrix.org>2014-09-11 17:40:38 +0100
commit81d061e74e9152c8fb4c340dd5b06329518f3299 (patch)
tree4cfe8ca66636577d20494c95da40327413a224f6 /webclient
parentClearly show when an user cannot join a room. (diff)
downloadsynapse-81d061e74e9152c8fb4c340dd5b06329518f3299.tar.xz
Fix bug where web client wold break trying to add the earliest token without having initialised the room if your first page of history contained only events which didn't call initRoom. Just call initRoom in handleMessages since we use it there rather than leaving it to the individual event handling methods.
Diffstat (limited to 'webclient')
-rw-r--r--webclient/components/matrix/event-handler-service.js13
1 files changed, 1 insertions, 12 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js
index 002a9fbd5d..0c86af1880 100644
--- a/webclient/components/matrix/event-handler-service.js
+++ b/webclient/components/matrix/event-handler-service.js
@@ -71,8 +71,6 @@ angular.module('eventHandlerService', [])
     };
     
     var handleRoomCreate = function(event, isLiveEvent) {
-        initRoom(event.room_id);
-
         // For now, we do not use the event data. Simply signal it to the app controllers
         $rootScope.$broadcast(ROOM_CREATE_EVENT, event, isLiveEvent);
     };
@@ -82,8 +80,6 @@ angular.module('eventHandlerService', [])
     };
 
     var handleMessage = function(event, isLiveEvent) {
-        initRoom(event.room_id);
-        
         if (isLiveEvent) {
             if (event.user_id === matrixService.config().user_id &&
                 (event.content.msgtype === "m.text" || event.content.msgtype === "m.emote") ) {
@@ -114,8 +110,6 @@ angular.module('eventHandlerService', [])
     };
     
     var handleRoomMember = function(event, isLiveEvent, isStateEvent) {
-        initRoom(event.room_id);
-        
         // if the server is stupidly re-relaying a no-op join, discard it.
         if (event.prev_content && 
             event.content.membership === "join" &&
@@ -152,8 +146,6 @@ angular.module('eventHandlerService', [])
     };
     
     var handlePowerLevels = function(event, isLiveEvent) {
-        initRoom(event.room_id);
-
         // Keep the latest data. Do not care of events that come when paginating back
         if (!$rootScope.events.rooms[event.room_id][event.type] || isLiveEvent) {
             $rootScope.events.rooms[event.room_id][event.type] = event;
@@ -164,8 +156,6 @@ angular.module('eventHandlerService', [])
     var handleRoomName = function(event, isLiveEvent) {
         console.log("handleRoomName " + isLiveEvent);
 
-        initRoom(event.room_id);
-
         $rootScope.events.rooms[event.room_id][event.type] = event;
         $rootScope.$broadcast(NAME_EVENT, event, isLiveEvent);
     };
@@ -174,8 +164,6 @@ angular.module('eventHandlerService', [])
     var handleRoomTopic = function(event, isLiveEvent, isStateEvent) {
         console.log("handleRoomTopic live="+isLiveEvent);
 
-        initRoom(event.room_id);
-
         // Add topic changes as if they were a room message
         if (!isStateEvent) {
             if (isLiveEvent) {
@@ -316,6 +304,7 @@ angular.module('eventHandlerService', [])
 
         // Handle messages from /initialSync or /messages
         handleRoomMessages: function(room_id, messages, isLiveEvents) {
+            initRoom(room_id);
             this.handleEvents(messages.chunk, isLiveEvents);
 
             // Store how far back we've paginated