0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-15 16:43:51 +01:00

Reinitialize room when creating a RoomController so that we start off with a clean slate, as it expects/

This commit is contained in:
Erik Johnston 2014-08-22 10:50:10 +01:00
parent dde50d4245
commit 74c90f7815
2 changed files with 13 additions and 1 deletions

View file

@ -45,6 +45,12 @@ angular.module('eventHandlerService', [])
} }
} }
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) { var handleMessage = function(event, isLiveEvent) {
if ("membership_target" in event.content) { if ("membership_target" in event.content) {
event.user_id = event.content.membership_target; event.user_id = event.content.membership_target;
@ -118,6 +124,10 @@ angular.module('eventHandlerService', [])
for (var i=0; i<events.length; i++) { for (var i=0; i<events.length; i++) {
this.handleEvent(events[i], isLiveEvents); this.handleEvent(events[i], isLiveEvents);
} }
} },
reInitRoom: function(room_id) {
reInitRoom(room_id);
},
}; };
}]); }]);

View file

@ -316,6 +316,8 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
}; };
var onInit2 = function() { var onInit2 = function() {
eventHandlerService.reInitRoom($scope.room_id);
// Join the room // Join the room
matrixService.join($scope.room_id).then( matrixService.join($scope.room_id).then(
function() { function() {