All users' status is invisible
-
users appear offline on /online page · Issue #6950 · NodeBB/NodeBB
https://community.nodebb.org/topic/13286/all-users-status-is-invisible
GitHub (github.com)
-
@djensen47 No set time yet, should be out though. https://github.com/NodeBB/NodeBB/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.11.0
-
sorry for pulling this topic up. but we face the same problem: after migrating from a proprietary forum software four out of five users logged on are set to "offline" while they are obviously online and active. the "online" users are either new or changed their status manually.
the title should be "all migrated users' status is invisible"
on the one hand i have basically no idea where to run the script mentioned by @PitaJ. on the other i'm not sure if the value of lastonline will be written to Date.now() then which would be nice to leave unchanged.
i'm wondering why a user isn't set to "online" by default with every login and has to change the status every time to "offline" or whatever manually if needed?!
-
@pitaj mentioned where to put the file, it goes into your nodebb installation folder, so in the same folder as your config.json.
A user is set to online when they register and then it is up to the user to change the status. For example a user can set their status to
offline
if they don't want to be seen online. -
@baris said in All users' status is invisible:
@pitaj mentioned where to put the file, it goes into your nodebb installation folder, so in the same folder as your config.json.
you are right. one should read until the end of a post. sorry.
A user is set to online when they register and then it is up to the user to change the status. For example a user can set their status to
offline
if they don't want to be seen online.i know. but more than 29,000 migrated users were set to
offline
(by fault) and didn't choose it.frankly speaking i would expect the software to set my status to
online
whenever i log on. let's say my status was set toabsent
- for whatever reason i forgot in the meantime - before i logged out. when i come back later i'm notabsent
anymore - i'monline
. in my opinion it should be no choice - for a normal user at least - to stay invisible forever.the other question was if the value of
lastonline
will be changed by the script toDate.now()
or not? i would prefer to leave it unchanged. -
@pitaj said in All users' status is invisible:
const data = {
lastonline,
status: 'online',
};The script @pitaj posted will set
lastonline
field of the user toDate.now
if you don't want that remove it from thedata
object above.Just to reiterate the
offline
status is special in that when the user sets themselves offline they appear offline to other users even if they are online. But admins can still them on/users?section=online
.Also if a user's status is set
online
and they aren't active for more than x minutes their status will be returned asoffline
until they come back. The value of thestatus
field in the database isn't modified automatically by nodebb it is only changed if the user changes it manually. -
@baris thank you for the detailed explanation. i was afraid setting
lastonline
toDate.now()
is needed to manipulate thestatus
field in the database.we have already seen that users are automatically set to
offline
after some [30?] minutes of inactivity - this is absolutely wanted as long as thestatus
field in the database stays untouched. great! -
@baris said in All users' status is invisible:
The script @pitaj posted will set lastonline field of the user to Date.now if you don't want that remove it from the data object above.
unfortunately we had to remove the other
lastonline
line(s) insetUsersOnline()
too.function setUsersOnline(callback) { var batch = require('./src/batch'); batch.processSortedSet('users:joindate', function (uids, next) { // const lastonline = Date.now(); const data = { // lastonline, status: 'online', }; async.parallel([ cb => async.each(uids, (uid, next) => { db.setObject(`user:${uid}`, data, next); }, cb), // cb => db.sortedSetAdd('users:online', uids.map(() => lastonline), uids, cb), ], next); }, callback); }
no idea why
lastonline
is manipulated by the script anyway. to force a re-login to see it taking effect the forum was rebuild and restarted after running the script.