crash fix

v1.18.x
barisusakli 11 years ago
parent 851d5c0f32
commit 32d46f3889

@ -93,8 +93,8 @@ Sockets.init = function(server) {
uid: uid uid: uid
}); });
socketUser.isOnline(socket, uid, function(err, data) { socketUser.isOnline(socket, [uid], function(err, data) {
socket.broadcast.emit('user.isOnline', err, data); socket.broadcast.emit('user.isOnline', err, data[0]);
}); });
}); });
}); });
@ -114,8 +114,8 @@ Sockets.init = function(server) {
if (uid && Sockets.getUserSockets(uid).length <= 1) { if (uid && Sockets.getUserSockets(uid).length <= 1) {
db.sortedSetRemove('users:online', uid, function(err) { db.sortedSetRemove('users:online', uid, function(err) {
socketUser.isOnline(socket, uid, function(err, data) { socketUser.isOnline(socket, [uid], function(err, data) {
socket.broadcast.emit('user.isOnline', err, data); socket.broadcast.emit('user.isOnline', err, data[0]);
}); });
}); });
} }

@ -227,6 +227,7 @@ SocketUser.getOnlineUsers = function(socket, uids, callback) {
if (err) { if (err) {
return callback(err); return callback(err);
} }
userData.forEach(function(user) { userData.forEach(function(user) {
if (user) { if (user) {
returnData[user.uid] = user; returnData[user.uid] = user;
@ -291,9 +292,9 @@ SocketUser.loadMore = function(socket, data, callback) {
SocketUser.setStatus = function(socket, status, callback) { SocketUser.setStatus = function(socket, status, callback) {
var server = require('./index'); var server = require('./index');
user.setUserField(socket.uid, 'status', status, function(err) { user.setUserField(socket.uid, 'status', status, function(err) {
SocketUser.isOnline(socket, socket.uid, function(err, data) { SocketUser.isOnline(socket, [socket.uid], function(err, data) {
server.server.sockets.emit('user.isOnline', err, data); server.server.sockets.emit('user.isOnline', err, data[0]);
callback(err, data); callback(err, data[0]);
}); });
}); });
}; };

@ -442,10 +442,6 @@ var bcrypt = require('bcryptjs'),
return user; return user;
}); });
if (uids.length === 1) {
userData = userData[0];
}
callback(null, userData); callback(null, userData);
}); });
}; };

Loading…
Cancel
Save