mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 10:06:13 +01:00
users.js fix
This commit is contained in:
@@ -8,7 +8,7 @@ define(['notifications', 'chat'], function(Notifications, Chat) {
|
|||||||
Chat.prepareDOM();
|
Chat.prepareDOM();
|
||||||
translator.prepareDOM();
|
translator.prepareDOM();
|
||||||
|
|
||||||
function updateUnreadCount(count) {
|
function updateUnreadCount(err, count) {
|
||||||
$('#unread-count').toggleClass('unread-count', count > 0);
|
$('#unread-count').toggleClass('unread-count', count > 0);
|
||||||
$('#unread-count').attr('data-content', count > 20 ? '20+' : count);
|
$('#unread-count').attr('data-content', count > 20 ? '20+' : count);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ define(function() {
|
|||||||
socket.on('user.isOnline', function(err, data) {
|
socket.on('user.isOnline', function(err, data) {
|
||||||
if(getActiveSection() == 'online' && !loadingMoreUsers) {
|
if(getActiveSection() == 'online' && !loadingMoreUsers) {
|
||||||
startLoading('users:online', 0, true);
|
startLoading('users:online', 0, true);
|
||||||
socket.emit('user.getOnlineAnonCount', {} , function(anonCount) {
|
socket.emit('user.getOnlineAnonCount', {} , function(err, anonCount) {
|
||||||
if(parseInt(anonCount, 10) > 0) {
|
if(parseInt(anonCount, 10) > 0) {
|
||||||
$('#users-container .anon-user').removeClass('hide');
|
$('#users-container .anon-user').removeClass('hide');
|
||||||
$('#online_anon_count').html(anonCount);
|
$('#online_anon_count').html(anonCount);
|
||||||
|
|||||||
@@ -117,12 +117,12 @@ SocketUser.getOnlineUsers = function(socket, data, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SocketUser.getOnlineAnonCount = function(socket, data, callback) {
|
SocketUser.getOnlineAnonCount = function(socket, data, callback) {
|
||||||
callback(module.parent.exports.getOnlineAnonCount());
|
callback(null, module.parent.exports.getOnlineAnonCount());
|
||||||
};
|
};
|
||||||
|
|
||||||
SocketUser.getUnreadCount = function(socket, data, callback) {
|
SocketUser.getUnreadCount = function(socket, data, callback) {
|
||||||
topics.getUnreadTids(socket.uid, 0, 19, function(err, tids) {
|
topics.getUnreadTids(socket.uid, 0, 19, function(err, tids) {
|
||||||
callback(tids.length);
|
callback(err, tids?tids.length:0);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -135,13 +135,13 @@ SocketUser.loadMore = function(socket, data, callback) {
|
|||||||
end = start + 19;
|
end = start + 19;
|
||||||
|
|
||||||
user.getUsers(data.set, start, end, function(err, data) {
|
user.getUsers(data.set, start, end, function(err, data) {
|
||||||
if (err) {
|
if(err) {
|
||||||
winston.err(err);
|
return callback(err);
|
||||||
} else {
|
|
||||||
callback({
|
|
||||||
users: data
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
callback(null, {
|
||||||
|
users: data
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user