mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
added flag to empty container
This commit is contained in:
@@ -83,18 +83,20 @@ define(function() {
|
||||
socket.on('api:user.isOnline', function(data) {
|
||||
if(getActiveSection() == 'online' && !loadingMoreUsers) {
|
||||
loadingMoreUsers = true;
|
||||
$('#users-inner-container').empty();
|
||||
startLoading('users:online', 0);
|
||||
|
||||
startLoading('users:online', 0, true);
|
||||
socket.emit('api:user.getOnlineAnonCount', {} , function(anonCount) {
|
||||
$('#online_anon_count').html(anonCount);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function onUsersLoaded(users) {
|
||||
function onUsersLoaded(users, emptyContainer) {
|
||||
var html = templates.prepare(templates['users'].blocks['users']).parse({
|
||||
users: users
|
||||
});
|
||||
if(emptyContainer)
|
||||
$('#users-inner-container').empty();
|
||||
$('#users-inner-container').append(html);
|
||||
}
|
||||
|
||||
@@ -115,14 +117,14 @@ define(function() {
|
||||
}
|
||||
}
|
||||
|
||||
function startLoading(set, after) {
|
||||
function startLoading(set, after, emptyContainer) {
|
||||
loadingMoreUsers = true;
|
||||
socket.emit('api:users.loadMore', {
|
||||
set: set,
|
||||
after: after
|
||||
}, function(data) {
|
||||
if (data.users.length) {
|
||||
onUsersLoaded(data.users);
|
||||
onUsersLoaded(data.users, emptyContainer);
|
||||
$('#load-more-users-btn').removeClass('disabled');
|
||||
} else {
|
||||
$('#load-more-users-btn').addClass('disabled');
|
||||
|
||||
Reference in New Issue
Block a user