Fix newSet detection on chat messages

v1.18.x
Julian Lam 10 years ago
parent 8b5195fa82
commit 98b74f848e

@ -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');

@ -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);

Loading…
Cancel
Save