Hello;
There is a problem with the private chat on Chrome for Android: i can write messages, but when I press Send, it doesn't get sent.
I use NodeBB 0.7.0
I apologize for my English.
I want to send a chat message to a user, and to ensure that the user will be notified via email, I set the user's lastonline
to 5 minutes before current timestamp.
I see that the user's lastonline
field is being set correctly (verified via api call), but the user is still not being notified via email.
// set lastonline field to 5 minutes before current timestamp
Users.setUserField(req.params.uid, 'lastonline', Date.now() - 300000, function(err) {
Messaging.newRoom(req.user.uid, [req.params.uid], function(err, roomId) {
Messaging.addMessage(req.user.uid, roomId, req.body.message, timestamp, function(err, message) {
// this should send an email notification to the user
Messaging.notifyUsersInRoom(req.user.uid, roomId, message);
return errorHandler.handle(err, res, message);
});
});
});
This is the condition which determines whether the user is online:
https://github.com/NodeBB/NodeBB/blob/dcb73f9647bd73acce0d0907d04d060e7fe05eb7/src/user.js#L152
I print the lastonline
field value inside the isOnline
method, which prints the previous set value and this is strange. Is this due to some kind of caching in the db layer? I am using mongodb by the way.
This commit shows that to make the user offline, all that's needed is to set the lastonline
field, so I am not sure what I'm missing.
https://github.com/NodeBB/NodeBB/commit/18e68346e713fce2efb49aff0b18bd2bbf0be332
@wktang is this option enabled for the user in their settings?
and do you have email subscriptions enabled in ACP?
@pichalite Yes. I have tested that if the user is not currently online, the user is able to receive email from executing the above code.