fix: lastonline again

v1.18.x
Barış Soner Uşaklı 4 years ago
parent 71d82ec8e0
commit a481024d27

@ -15,7 +15,7 @@ const usersController = module.exports;
const userFields = [ const userFields = [
'uid', 'username', 'userslug', 'email', 'postcount', 'joindate', 'banned', 'uid', 'username', 'userslug', 'email', 'postcount', 'joindate', 'banned',
'reputation', 'picture', 'flags', 'email:confirmed', 'reputation', 'picture', 'flags', 'lastonline', 'email:confirmed',
]; ];
usersController.index = async function (req, res) { usersController.index = async function (req, res) {
@ -102,8 +102,9 @@ async function getUsers(req, res) {
userData.forEach((user, index) => { userData.forEach((user, index) => {
if (user) { if (user) {
user.administrator = isAdmin[index]; user.administrator = isAdmin[index];
user.lastonline = lastonline[index]; const timestamp = lastonline[index] || userData.joindate;
user.lastonlineISO = utils.toISOString(lastonline[index]); user.lastonline = timestamp;
user.timestampISO = utils.toISOString(lastonline);
} }
}); });
return userData; return userData;

Loading…
Cancel
Save