From 4777c1cd5bfb33c4aa4bcc7d6364339f0c40ef5a Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Wed, 3 Sep 2014 15:00:04 +0200 Subject: [PATCH] BF: Do not be polluted by ops events that come when paginating back --- webclient/components/matrix/event-handler-service.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js index 908a9fe2b5..7c62cd1b5d 100644 --- a/webclient/components/matrix/event-handler-service.js +++ b/webclient/components/matrix/event-handler-service.js @@ -108,8 +108,11 @@ angular.module('eventHandlerService', []) var handlePowerLevels = function(event, isLiveEvent) { initRoom(event.room_id); - $rootScope.events.rooms[event.room_id][event.type] = event; - $rootScope.$broadcast(POWERLEVEL_EVENT, event, isLiveEvent); + // 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; + $rootScope.$broadcast(POWERLEVEL_EVENT, event, isLiveEvent); + } }; var handleCallEvent = function(event, isLiveEvent) {