summary refs log tree commit diff
path: root/webclient
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-15 10:39:30 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-15 10:39:30 +0200
commita9da2ec895ad5caccda16e60e40f21360c6a5a73 (patch)
treec74df14a563873b0571fd43783908ae9f6e2bf06 /webclient
parentUse "white-space: pre-wrap" for "Text will wrap when necessary, and on line b... (diff)
downloadsynapse-a9da2ec895ad5caccda16e60e40f21360c6a5a73.tar.xz
BF: presence and eventMap were not reset at logout.
Diffstat (limited to '')
-rw-r--r--webclient/components/matrix/event-handler-service.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js
index 705a5a07f2..4604ff6192 100644
--- a/webclient/components/matrix/event-handler-service.js
+++ b/webclient/components/matrix/event-handler-service.js
@@ -38,6 +38,13 @@ angular.module('eventHandlerService', [])
     var TOPIC_EVENT = "TOPIC_EVENT";
     var RESET_EVENT = "RESET_EVENT";    // eventHandlerService has been resetted
 
+    // used for dedupping events - could be expanded in future...
+    // FIXME: means that we leak memory over time (along with lots of the rest
+    // of the app, given we never try to reap memory yet)
+    var eventMap = {};
+
+    $rootScope.presence = {};
+
     var initialSyncDeferred;
 
     var reset = function() {
@@ -46,16 +53,13 @@ angular.module('eventHandlerService', [])
         $rootScope.events = {
             rooms: {} // will contain roomId: { messages:[], members:{userid1: event} }
         };
-    }
-    reset();
 
-    // used for dedupping events - could be expanded in future...
-    // FIXME: means that we leak memory over time (along with lots of the rest
-    // of the app, given we never try to reap memory yet)
-    var eventMap = {};
+        $rootScope.presence = {};
+
+        eventMap = {};
+    };
+    reset();
 
-    $rootScope.presence = {};
-    
     var initRoom = function(room_id) {
         if (!(room_id in $rootScope.events.rooms)) {
             console.log("Creating new handler entry for " + room_id);
@@ -204,7 +208,7 @@ angular.module('eventHandlerService', [])
 
     var handleCallEvent = function(event, isLiveEvent) {
         $rootScope.$broadcast(CALL_EVENT, event, isLiveEvent);
-        if (event.type == 'm.call.invite') {
+        if (event.type === 'm.call.invite') {
             $rootScope.events.rooms[event.room_id].messages.push(event);
         }
     };
@@ -231,7 +235,7 @@ angular.module('eventHandlerService', [])
             }
         }
         return index;
-    }
+    };
     
     return {
         ROOM_CREATE_EVENT: ROOM_CREATE_EVENT,