diff --git a/src/user/data.js b/src/user/data.js index 6f2a2dd4b7..d0c70ce80c 100644 --- a/src/user/data.js +++ b/src/user/data.js @@ -50,6 +50,10 @@ module.exports = function(User) { addField('uploadedpicture'); } + if (fields.indexOf('status') !== -1) { + addField('lastonline'); + } + db.getObjectsFields(keys, fields, function(err, users) { if (err) { return callback(err); @@ -117,6 +121,10 @@ module.exports = function(User) { user.uploadedpicture = user.uploadedpicture.startsWith('http') ? user.uploadedpicture : nconf.get('relative_path') + user.uploadedpicture; } + if (user.hasOwnProperty('status') && parseInt(user.lastonline, 10)) { + user.status = User.getStatus(user); + } + for(var i=0; i