0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-15 05:33:53 +01:00

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

This commit is contained in:
Emmanuel ROHEE 2014-09-10 14:53:03 +02:00
parent 130cbdd7af
commit da3f842b8c
2 changed files with 2 additions and 25 deletions

View file

@ -104,9 +104,7 @@ angular.module('eventStreamService', [])
settings.isActive = true; settings.isActive = true;
var deferred = $q.defer(); var deferred = $q.defer();
// FIXME: We are discarding all the messages. // Initial sync: get all information and the last message of all rooms of the user
// 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( matrixService.initialSync(1, false).then(
function(response) { function(response) {
var rooms = response.data.rooms; var rooms = response.data.rooms;
@ -128,6 +126,7 @@ angular.module('eventStreamService', [])
// Initial sync is done // Initial sync is done
eventHandlerService.handleInitialSyncDone(response); eventHandlerService.handleInitialSyncDone(response);
// Start event streaming from that point
settings.from = response.data.end; settings.from = response.data.end;
doEventStream(deferred); doEventStream(deferred);
}, },

View file

@ -16,12 +16,6 @@
'use strict'; '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']) angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHandlerService'])
.controller('RecentsController', ['$rootScope', '$scope', 'matrixService', 'eventHandlerService', .controller('RecentsController', ['$rootScope', '$scope', 'matrixService', 'eventHandlerService',
function($rootScope, $scope, matrixService, eventHandlerService) { function($rootScope, $scope, matrixService, eventHandlerService) {
@ -34,11 +28,6 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand
// in order to highlight a specific room in the list // in order to highlight a specific room in the list
$rootScope.recentsSelectedRoomID; $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() { var listenToEventStream = function() {
// Refresh the list on matrix invitation and message event // Refresh the list on matrix invitation and message event
$rootScope.$on(eventHandlerService.MEMBER_EVENT, function(ngEvent, event, isLive) { $rootScope.$on(eventHandlerService.MEMBER_EVENT, function(ngEvent, event, isLive) {
@ -85,23 +74,12 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand
return; 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 = {}; $rootScope.rooms = {};
// Use initialSync data to init the recents list // Use initialSync data to init the recents list
eventHandlerService.waitForInitialSyncCompletion().then( eventHandlerService.waitForInitialSyncCompletion().then(
function(initialSyncData) { 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; var rooms = initialSyncData.data.rooms;
for (var i=0; i<rooms.length; i++) { for (var i=0; i<rooms.length; i++) {
var room = rooms[i]; var room = rooms[i];