summary refs log tree commit diff
path: root/webclient/components
diff options
context:
space:
mode:
authorEmmanuel ROHEE <manu@Emmanuels-MacBook-Pro.local>2014-09-08 18:13:22 +0200
committerEmmanuel ROHEE <manu@Emmanuels-MacBook-Pro.local>2014-09-08 18:14:35 +0200
commit21d6ce2380109c2854c7589702c22b553c2ca6ac (patch)
treeb583c415dd61b47c15aebfcea52af3d80c5c2007 /webclient/components
parentadd sounds to the calling interface (diff)
downloadsynapse-21d6ce2380109c2854c7589702c22b553c2ca6ac.tar.xz
App startup improvements:
 - do one and only one initialSync when the app starts. (recents-controller does not do its own anymore)
 - initialSync: get only the last message per room instead of default number of messages (10)

Prevent recents-controller from loosing its data each time the page URL changes
Diffstat (limited to 'webclient/components')
-rw-r--r--webclient/components/matrix/event-handler-service.js8
-rw-r--r--webclient/components/matrix/event-stream-service.js4
2 files changed, 6 insertions, 6 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js
index d2bb31053f..173055a61b 100644
--- a/webclient/components/matrix/event-handler-service.js
+++ b/webclient/components/matrix/event-handler-service.js
@@ -36,7 +36,7 @@ angular.module('eventHandlerService', [])
     var CALL_EVENT = "CALL_EVENT";
     var NAME_EVENT = "NAME_EVENT";
 
-    var InitialSyncDeferred = $q.defer();
+    var initialSyncDeferred = $q.defer();
     
     $rootScope.events = {
         rooms: {} // will contain roomId: { messages:[], members:{userid1: event} }
@@ -220,14 +220,14 @@ angular.module('eventHandlerService', [])
             }
         },
 
-        handleInitialSyncDone: function() {
+        handleInitialSyncDone: function(initialSyncData) {
             console.log("# handleInitialSyncDone");
-            InitialSyncDeferred.resolve($rootScope.events, $rootScope.presence);
+            initialSyncDeferred.resolve(initialSyncData);
         },
 
         // Returns a promise that resolves when the initialSync request has been processed
         waitForInitialSyncCompletion: function() {
-            return InitialSyncDeferred.promise;
+            return initialSyncDeferred.promise;
         },
 
         resetRoomMessages: function(room_id) {
diff --git a/webclient/components/matrix/event-stream-service.js b/webclient/components/matrix/event-stream-service.js
index ed4f3b2ffc..28422c4cb9 100644
--- a/webclient/components/matrix/event-stream-service.js
+++ b/webclient/components/matrix/event-stream-service.js
@@ -105,7 +105,7 @@ angular.module('eventStreamService', [])
         var deferred = $q.defer();
 
         // FIXME: We are discarding all the messages.
-        matrixService.rooms().then(
+        matrixService.rooms(1, false).then(
             function(response) {
                 var rooms = response.data.rooms;
                 for (var i = 0; i < rooms.length; ++i) {
@@ -120,7 +120,7 @@ angular.module('eventStreamService', [])
                 eventHandlerService.handleEvents(presence, false);
 
                 // Initial sync is done
-                eventHandlerService.handleInitialSyncDone();
+                eventHandlerService.handleInitialSyncDone(response);
 
                 settings.from = response.data.end;
                 doEventStream(deferred);