summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-16 15:42:31 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-16 16:16:11 +0200
commita284de73e621e7f67212982046130416c042b386 (patch)
tree8945d2b579ac377536afd736605b32769fb5f981
parentWEB-29: Improve room page content loading (diff)
downloadsynapse-a284de73e621e7f67212982046130416c042b386.tar.xz
If an initialSync has been already done on a room, we do not need to paginate back to get more messages
-rw-r--r--webclient/room/room-controller.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index 8cea0511c1..d3888cae86 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -684,6 +684,10 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
                 
                 // The room members is available in the data fetched by initialSync
                 if ($rootScope.events.rooms[$scope.room_id]) {
+
+                    // There is no need to do a 1st pagination (initialSync provided enough to fill a page)
+                    $scope.state.first_pagination = false;
+
                     var members = $rootScope.events.rooms[$scope.room_id].members;
 
                     // Update the member list
@@ -743,9 +747,18 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
                 // Arm list timing update timer
                 updateMemberListPresenceAge();
 
-                // Start pagination
+                // Allow pagination
                 $scope.state.can_paginate = true;
-                paginate(MESSAGES_PER_PAGINATION);
+
+                // Do a first pagination only if it is required
+                // FIXME: Should be no more require when initialSync/{room_id} will be available
+                if ($scope.state.first_pagination) {
+                    paginate(MESSAGES_PER_PAGINATION);
+                }
+                else {
+                    // There are already messages, go to the last message
+                    scrollToBottom(true);
+                }
             },
             function(error) {
                 $scope.feedback = "Failed get member list: " + error.data.error;