From da3f842b8cea7d259d4d2d980020625b9703b1ee Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Wed, 10 Sep 2014 14:53:03 +0200 Subject: [PATCH] Removed wrong comments about recents-controller.js: it uses $rootScope.rooms not $rootScope.events.rooms managed by event-handler-service.js and used by other controllers --- .../components/matrix/event-stream-service.js | 5 ++--- webclient/recents/recents-controller.js | 22 ------------------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/webclient/components/matrix/event-stream-service.js b/webclient/components/matrix/event-stream-service.js index 249af193d..03b805213 100644 --- a/webclient/components/matrix/event-stream-service.js +++ b/webclient/components/matrix/event-stream-service.js @@ -104,9 +104,7 @@ angular.module('eventStreamService', []) settings.isActive = true; 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. + // Initial sync: get all information and the last message of all rooms of the user matrixService.initialSync(1, false).then( function(response) { var rooms = response.data.rooms; @@ -128,6 +126,7 @@ angular.module('eventStreamService', []) // Initial sync is done eventHandlerService.handleInitialSyncDone(response); + // Start event streaming from that point settings.from = response.data.end; doEventStream(deferred); }, diff --git a/webclient/recents/recents-controller.js b/webclient/recents/recents-controller.js index 0553eb9be..aedc7b7a4 100644 --- a/webclient/recents/recents-controller.js +++ b/webclient/recents/recents-controller.js @@ -16,12 +16,6 @@ '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) { @@ -33,11 +27,6 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand // $rootScope of the parent where the recents component is included can override this value // 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 @@ -85,23 +74,12 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand 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 eventHandlerService.waitForInitialSyncCompletion().then( function(initialSyncData) { - // XXX FIXME TODO: - // Any assignments to the rootScope here should be done in - // event handler service and not here, because we could have - // many controllers manipulating and clobbering each other, and - // are unecessarily repeating http requests. var rooms = initialSyncData.data.rooms; for (var i=0; i