From a481024d27edaa4bc262bce8c4609942659af947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 13 Oct 2020 23:02:49 -0400 Subject: [PATCH] fix: lastonline again --- src/controllers/admin/users.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/controllers/admin/users.js b/src/controllers/admin/users.js index 0f31a11cab..eb22523550 100644 --- a/src/controllers/admin/users.js +++ b/src/controllers/admin/users.js @@ -15,7 +15,7 @@ const usersController = module.exports; const userFields = [ 'uid', 'username', 'userslug', 'email', 'postcount', 'joindate', 'banned', - 'reputation', 'picture', 'flags', 'email:confirmed', + 'reputation', 'picture', 'flags', 'lastonline', 'email:confirmed', ]; usersController.index = async function (req, res) { @@ -102,8 +102,9 @@ async function getUsers(req, res) { userData.forEach((user, index) => { if (user) { user.administrator = isAdmin[index]; - user.lastonline = lastonline[index]; - user.lastonlineISO = utils.toISOString(lastonline[index]); + const timestamp = lastonline[index] || userData.joindate; + user.lastonline = timestamp; + user.timestampISO = utils.toISOString(lastonline); } }); return userData;