summary refs log tree commit diff
path: root/webclient/components
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-22 10:50:10 +0100
committerErik Johnston <erik@matrix.org>2014-08-22 10:51:00 +0100
commit74c90f78159e8067b25bfa8a009d2e68419947c8 (patch)
tree61a13587e176299667dcae796ccebf1563e5f34d /webclient/components
parentUse $location.url instead of $location.path to get clean page URL without has... (diff)
downloadsynapse-74c90f78159e8067b25bfa8a009d2e68419947c8.tar.xz
Reinitialize room when creating a RoomController so that we start off with a clean slate, as it expects/
Diffstat (limited to 'webclient/components')
-rw-r--r--webclient/components/matrix/event-handler-service.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js
index 6a01b3fb55..aa8867425e 100644
--- a/webclient/components/matrix/event-handler-service.js
+++ b/webclient/components/matrix/event-handler-service.js
@@ -44,6 +44,12 @@ angular.module('eventHandlerService', [])
             $rootScope.events.rooms[room_id].members = {};
         }
     }
+
+    var reInitRoom = function(room_id) {
+        $rootScope.events.rooms[room_id] = {};
+        $rootScope.events.rooms[room_id].messages = [];
+        $rootScope.events.rooms[room_id].members = {};
+    }
     
     var handleMessage = function(event, isLiveEvent) {
         if ("membership_target" in event.content) {
@@ -118,6 +124,10 @@ angular.module('eventHandlerService', [])
             for (var i=0; i<events.length; i++) {
                 this.handleEvent(events[i], isLiveEvents);
             }
-        }
+        },
+
+        reInitRoom: function(room_id) {
+            reInitRoom(room_id);
+        },
     };
 }]);