mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
feat: change chat notification delivery
instead of checking if user is online in the past x minutes, check if the user has read the room, if they have already marked the chat as read don't send notification
This commit is contained in:
@@ -57,8 +57,9 @@ module.exports = function (Messaging) {
|
||||
};
|
||||
|
||||
async function sendNotifications(fromuid, uids, roomId, messageObj) {
|
||||
const isOnline = await user.isOnline(uids);
|
||||
uids = uids.filter((uid, index) => !isOnline[index] && parseInt(fromuid, 10) !== parseInt(uid, 10));
|
||||
const hasRead = await Messaging.hasRead(uids, roomId);
|
||||
uids = uids.filter((uid, index) => !hasRead[index] && parseInt(fromuid, 10) !== parseInt(uid, 10));
|
||||
console.log('checking notif', uids, hasRead);
|
||||
if (!uids.length) {
|
||||
delete Messaging.notifyQueue[`${fromuid}:${roomId}`];
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user