|
|
@ -27,7 +27,12 @@ module.exports = function(SocketUser) {
|
|
|
|
if (allowedStatus.indexOf(status) === -1) {
|
|
|
|
if (allowedStatus.indexOf(status) === -1) {
|
|
|
|
return callback(new Error('[[error:invalid-user-status]]'));
|
|
|
|
return callback(new Error('[[error:invalid-user-status]]'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
user.setUserField(socket.uid, 'status', status, function(err) {
|
|
|
|
|
|
|
|
|
|
|
|
var data = {status: status};
|
|
|
|
|
|
|
|
if (status !== 'offline') {
|
|
|
|
|
|
|
|
data.lastonline = Date.now();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
user.setUserFields(socket.uid, data, function(err) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
return callback(err);
|
|
|
|
return callback(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|