Load lines before nicklist

Nicklist is not nearly as important as the actual lines, load them first for better perceived performance. Parsing the nicklist can take a noticeable amount of time for channels with thousands of occupants.

This also improves/fixes the nicklist emptiness check
This commit is contained in:
Lorenz Hübschle-Schneider 2014-03-08 21:26:15 +00:00
commit 730c7dab8d
2 changed files with 28 additions and 12 deletions

View file

@ -147,13 +147,25 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
}
};
// Check if the nicklist is empty, i.e., no nicks present
// This checks for the presence of people, not whether a
// request for the nicklist has been made
var isNicklistEmpty = function() {
for (var obj in nicklist) {
return false;
if (obj !== 'root') {
return false;
}
}
return true;
};
var nicklistRequested = function() {
// If the nicklist has been requested but is empty, it
// still has a 'root' property. Check for its existence.
return nicklist.hasOwnProperty('root');
};
return {
id: pointer,
fullName: fullName,
@ -179,7 +191,8 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
addToHistory: addToHistory,
getHistoryUp: getHistoryUp,
getHistoryDown: getHistoryDown,
isNicklistEmpty: isNicklistEmpty
isNicklistEmpty: isNicklistEmpty,
nicklistRequested: nicklistRequested
};
};