mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	fix: suppress chat message notifications for users who are known to be in the chat room (uid is present in the corresponding socket.io room)
This commit is contained in:
		| @@ -84,7 +84,7 @@ module.exports = function (Messaging) { | ||||
| 			Messaging.getRoomData(roomId), | ||||
| 		]); | ||||
| 		const roomDefault = roomData.notificationSetting; | ||||
| 		const uidsToNotify = []; | ||||
| 		let uidsToNotify = []; | ||||
| 		const { ALLMESSAGES } = Messaging.notificationSettings; | ||||
| 		await batch.processSortedSet(`chat:room:${roomId}:uids:online`, async (uids) => { | ||||
| 			uids = uids.filter( | ||||
| @@ -99,6 +99,10 @@ module.exports = function (Messaging) { | ||||
| 			interval: 100, | ||||
| 		}); | ||||
|  | ||||
| 		// Suppress notifications for users who are literally present in the room | ||||
| 		const realtimeUids = await io.getUidsInRoom(`chat_room_${roomId}`); | ||||
| 		uidsToNotify = uidsToNotify.filter(uid => !realtimeUids.includes(parseInt(uid, 10))); | ||||
|  | ||||
| 		if (uidsToNotify.length) { | ||||
| 			const { displayname } = messageObj.fromUser; | ||||
| 			const isGroupChat = await Messaging.isGroupChat(roomId); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user