mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	closed #652
This commit is contained in:
		| @@ -77,6 +77,8 @@ var socket, | ||||
| 							} | ||||
| 							app.enterRoom(room, true); | ||||
|  | ||||
| 							socket.emit('reconnected'); | ||||
|  | ||||
| 							setTimeout(function() { | ||||
| 								reconnectEl.removeClass('active'); | ||||
| 							}, 3000); | ||||
|   | ||||
| @@ -867,7 +867,6 @@ var bcrypt = require('bcrypt'), | ||||
|  | ||||
| 	User.pushNotifCount = function(uid) { | ||||
| 		User.notifications.getUnreadCount(uid, function(err, count) { | ||||
| 			console.log('unread count is', count); | ||||
| 			if (!err) { | ||||
| 				websockets.in('uid_' + uid).emit('event:notifications.updateCount', count); | ||||
| 			} else { | ||||
|   | ||||
| @@ -135,6 +135,21 @@ websockets.init = function(io) { | ||||
| 			} | ||||
| 		}); | ||||
|  | ||||
| 		socket.on('reconnected', function() { | ||||
| 			if (uid) { | ||||
| 				topics.pushUnreadCount(uid); | ||||
| 				user.pushNotifCount(uid); | ||||
| 			} | ||||
|  | ||||
| 			if (process.env.NODE_ENV === 'development') { | ||||
| 				if (uid) { | ||||
| 					winston.info('[socket] uid ' + uid + ' (' + sessionID + ') has successfully reconnected.'); | ||||
| 				} else { | ||||
| 					winston.info('[socket] An anonymous user (' + sessionID + ') has successfully reconnected.'); | ||||
| 				} | ||||
| 			} | ||||
| 		}); | ||||
|  | ||||
| 		socket.on('api:get_all_rooms', function(data) { | ||||
| 			socket.emit('api:get_all_rooms', io.sockets.manager.rooms); | ||||
| 		}); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user