If an initialSync has been already done on a room, we do not need to paginate back to get more messages

This commit is contained in:
Emmanuel ROHEE 2014-09-16 15:42:31 +02:00
parent 45592ccdfd
commit a284de73e6
1 changed files with 15 additions and 2 deletions

View File

@ -684,6 +684,10 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
// The room members is available in the data fetched by initialSync // The room members is available in the data fetched by initialSync
if ($rootScope.events.rooms[$scope.room_id]) { 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; var members = $rootScope.events.rooms[$scope.room_id].members;
// Update the member list // Update the member list
@ -743,9 +747,18 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
// Arm list timing update timer // Arm list timing update timer
updateMemberListPresenceAge(); updateMemberListPresenceAge();
// Start pagination // Allow pagination
$scope.state.can_paginate = true; $scope.state.can_paginate = true;
// 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); paginate(MESSAGES_PER_PAGINATION);
}
else {
// There are already messages, go to the last message
scrollToBottom(true);
}
}, },
function(error) { function(error) {
$scope.feedback = "Failed get member list: " + error.data.error; $scope.feedback = "Failed get member list: " + error.data.error;