mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	closes #1381
This commit is contained in:
		| @@ -51,6 +51,12 @@ define(['taskbar', 'string', 'sounds'], function(taskbar, S, sounds) { | ||||
| 		}); | ||||
|  | ||||
| 		socket.on('event:chats.receive', function(data) { | ||||
|  | ||||
| 			var username = data.message.fromUser.username; | ||||
| 			if(parseInt(data.message.fromUser.uid, 10) === parseInt(app.uid, 10)) { | ||||
| 				username = data.message.toUser.username; | ||||
| 			} | ||||
|  | ||||
| 			if (module.modalExists(data.withUid)) { | ||||
| 				var modal = module.getModal(data.withUid); | ||||
| 				module.appendChatMessage(modal, data.message); | ||||
| @@ -65,12 +71,12 @@ define(['taskbar', 'string', 'sounds'], function(taskbar, S, sounds) { | ||||
| 				} | ||||
|  | ||||
| 				if (!modal.is(":visible") || !app.isFocused) { | ||||
| 					app.alternatingTitle(data.message.user.username + ' has messaged you'); | ||||
| 					app.alternatingTitle(username + ' has messaged you'); | ||||
| 				} | ||||
| 			} else { | ||||
| 				module.createModal(data.message.user.username, data.withUid, function(modal) { | ||||
| 				module.createModal(username, data.withUid, function(modal) { | ||||
| 					module.toggleNew(modal.attr('UUID'), true); | ||||
| 					app.alternatingTitle(data.message.user.username + ' has messaged you'); | ||||
| 					app.alternatingTitle(username + ' has messaged you'); | ||||
| 				}); | ||||
| 			} | ||||
|  | ||||
| @@ -242,8 +248,8 @@ define(['taskbar', 'string', 'sounds'], function(taskbar, S, sounds) { | ||||
|  | ||||
|  | ||||
| 		if (data.fromuid !== chatContent.children().last().attr('data-uid')) { | ||||
| 			var userPicture = $('<a href="/user/' + data.user.userslug + '"><img class="chat-user-image" src="' + data.user.picture + '"></a>'); | ||||
| 			var userName = $('<strong><span class="chat-user"> '+ data.user.username + '</span></strong>'); | ||||
| 			var userPicture = $('<a href="/user/' + data.fromUser.userslug + '"><img class="chat-user-image" src="' + data.fromUser.picture + '"></a>'); | ||||
| 			var userName = $('<strong><span class="chat-user"> '+ data.fromUser.username + '</span></strong>'); | ||||
| 			userName.toggleClass('chat-user-you', isYou); | ||||
|  | ||||
| 			message.append(userPicture) | ||||
|   | ||||
| @@ -77,7 +77,8 @@ var db = require('./database'), | ||||
| 				} | ||||
|  | ||||
| 				async.map(messages, function(message, next) { | ||||
| 					message.user = parseInt(message.fromuid, 10) === parseInt(fromuid, 10) ? userData[0] : userData[1]; | ||||
| 					message.fromUser = userData[0]; | ||||
| 					message.toUser = userData[1]; | ||||
|  | ||||
| 					Messaging.parse(message.content, message.fromuid, fromuid, userData[1], userData[0], isNew, function(result) { | ||||
| 						message.content = result; | ||||
|   | ||||
| @@ -174,7 +174,7 @@ SocketModules.chats.send = function(socket, data, callback) { | ||||
| 			return callback(err); | ||||
| 		} | ||||
|  | ||||
| 		sendChatNotification(socket.uid, touid, message.user.username); | ||||
| 		sendChatNotification(socket.uid, touid, message.fromUser.username); | ||||
|  | ||||
| 		server.getUserSockets(touid).forEach(function(s) { | ||||
| 			s.emit('event:chats.receive', { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user