Added big massive TODOs on a huge design problem with initial sync

pull/10/head
Kegan Dougal 2014-09-08 13:54:09 -07:00
parent 054fad5360
commit da9b7b0368
2 changed files with 20 additions and 1 deletions

View File

@ -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;

View File

@ -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) {
@ -59,6 +70,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