more fixes

v1.18.x
Baris Soner Usakli 11 years ago
parent 2893693d17
commit 7470c1bbd9

@ -9,18 +9,27 @@ define(function() {
'user.getActiveUsers'
]);
socket.emit('user.count', function(data) {
socket.emit('user.count', updateUserCount);
socket.on('user.count', updateUserCount);
function updateUserCount(err, data) {
$('#stats_users').html(utils.makeNumberHumanReadable(data.count)).attr('title', data.count);
});
}
socket.emit('meta.getUsageStats', function(data) {
socket.emit('meta.getUsageStats', updateUsageStats);
socket.on('meta.getUsageStats', updateUsageStats);
function updateUsageStats(err, data) {
$('#stats_topics').html(utils.makeNumberHumanReadable(data.topics)).attr('title', data.topics);
$('#stats_posts').html(utils.makeNumberHumanReadable(data.posts)).attr('title', data.posts);
});
}
socket.emit('user.getActiveUsers', updateActiveUsers);
socket.on('user.getActiveUsers', updateActiveUsers);
socket.emit('user.getActiveUsers', function(data) {
function updateActiveUsers(err, data) {
$('#stats_online').html(data.users);
});
}
}
return home;

@ -139,8 +139,8 @@ Sockets.init = function() {
}
});
}
console.log('derp');
console.log(payload, callback);
var parts = payload.name.split('.'),
namespace = parts.slice(0, 1),
methodToCall = parts.reduce(function(prev, cur) {
@ -182,7 +182,7 @@ Sockets.logoutUser = function(uid) {
Sockets.emitUserCount = function() {
db.getObjectField('global', 'userCount', function(err, count) {
io.sockets.emit('user.count', {
io.sockets.emit('user.count', err?{message:err.message}:null, {
count: count
});
});
@ -261,9 +261,9 @@ function emitTopicPostStats(callback) {
};
if (!callback) {
io.sockets.emit('post.stats', stats);
io.sockets.emit('post.stats', null, stats);
} else {
callback(stats);
callback(null, stats);
}
});
}
@ -282,9 +282,9 @@ function emitOnlineUserCount(callback) {
};
if (callback) {
callback(returnObj);
callback(null, returnObj);
} else {
io.sockets.emit('user.active.get', returnObj);
io.sockets.emit('user.getActiveUsers', null, returnObj);
}
}

@ -673,10 +673,10 @@ var bcrypt = require('bcrypt'),
User.count = function(callback) {
db.getObjectField('global', 'userCount', function(err, count) {
if(err) {
return;
return callback(err);
}
callback({
callback(null, {
count: count ? count : 0
});
});

Loading…
Cancel
Save