callback = callback || function() {};
User.updateLastOnlineTime = function(uid, callback) {
callback = callback || function() {};
db.getObjectFields('user:' + uid, ['status', 'lastonline'], function(err, userData) {
var now = Date.now();
if (err || userData.status === 'offline' || now - parseInt(userData.lastonline, 10) < 300000) {
return callback(err);
}
User.setUserField(uid, 'lastonline', now, callback);
});
};
function isFunction(fn) {
var obj= {};
return fn && obj.toString.call(fn) === '[object Function]';
}
callback = isFunction(callback) || function() {};