diff --git a/public/src/client/chats.js b/public/src/client/chats.js index d9b309bd5d..373a97d71c 100644 --- a/public/src/client/chats.js +++ b/public/src/client/chats.js @@ -136,11 +136,13 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll', Chats.addSocketListeners = function() { socket.on('event:chats.receive', function(data) { var typingNotifEl = $('.user-typing'), - containerEl = $('.expanded-chat ul'); + containerEl = $('.expanded-chat ul'), + lastSpeaker = parseInt(containerEl.find('.chat-message').last().attr('data-uid'), 10); if (Chats.isCurrentChat(data.withUid)) { newMessage = data.self === 0; data.message.self = data.self; + data.message.newSet = lastSpeaker !== data.message.fromuid; Chats.parseMessage(data.message, onMessagesParsed); } else { $('.chats-list li[data-uid="' + data.withUid + '"]').addClass('unread'); diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index 8d2fe2217b..5e9c5c7b42 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -457,7 +457,10 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra } module.appendChatMessage = function(chatModal, data, done) { - var chatContent = chatModal.find('.chat-content'); + var chatContent = chatModal.find('.chat-content'), + lastSpeaker = parseInt(chatContent.find('.chat-message').last().attr('data-uid'), 10); + + data.newSet = lastSpeaker !== data.fromuid; Chats.parseMessage(data, function(html) { var message = $(html);