diff options
-rw-r--r-- | webclient/components/matrix/event-stream-service.js | 2 | ||||
-rw-r--r-- | webclient/recents/recents-controller.js | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/webclient/components/matrix/event-stream-service.js b/webclient/components/matrix/event-stream-service.js index 4c0091dedb..1bc850a8fa 100644 --- a/webclient/components/matrix/event-stream-service.js +++ b/webclient/components/matrix/event-stream-service.js @@ -105,6 +105,8 @@ angular.module('eventStreamService', []) var deferred = $q.defer(); // FIXME: We are discarding all the messages. + // XXX FIXME TODO : The discard works because we are doing this all over + // again on EVERY INSTANTIATION of the recents controller. matrixService.initialSync(1, false).then( function(response) { var rooms = response.data.rooms; diff --git a/webclient/recents/recents-controller.js b/webclient/recents/recents-controller.js index fcb203b36c..b4762acd1d 100644 --- a/webclient/recents/recents-controller.js +++ b/webclient/recents/recents-controller.js @@ -16,6 +16,12 @@ 'use strict'; +// XXX FIXME TODO +// We should NOT be dumping things into $rootScope!!!! We should NOT be +// making any requests here, and should READ what is already in the +// rootScope from the event handler service!!! +// XXX FIXME TODO + angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHandlerService']) .controller('RecentsController', ['$rootScope', '$scope', 'matrixService', 'eventHandlerService', function($rootScope, $scope, matrixService, eventHandlerService) { @@ -28,6 +34,11 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand // in order to highlight a specific room in the list $rootScope.recentsSelectedRoomID; + // XXX FIXME TODO : We should NOT be doing this here, which could be + // repeated for every controller instance. We should be doing this in + // event handler service instead. In additon, this will break if there + // isn't a recents controller visible when the last message comes in :/ + var listenToEventStream = function() { // Refresh the list on matrix invitation and message event $rootScope.$on(eventHandlerService.MEMBER_EVENT, function(ngEvent, event, isLive) { @@ -58,7 +69,13 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand if ($rootScope.rooms) { return; } - + + // XXX FIXME TODO + // We should NOT be dumping things into $rootScope!!!! We should NOT be + // making any requests here, and should READ what is already in the + // rootScope from the event handler service!!! + // XXX FIXME TODO + $rootScope.rooms = {}; // Use initialSync data to init the recents list |