diff --git a/public/src/client/chats.js b/public/src/client/chats.js index 1a4cdb1056..9dc1c9d8e0 100644 --- a/public/src/client/chats.js +++ b/public/src/client/chats.js @@ -197,7 +197,12 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll', Chats.loadChatSince(uid, $('.chat-content'), 'recent'); Chats.addSendHandlers(uid, components.get('chat/input'), $('[data-action="send"]')); - contactEl.addClass('bg-primary').siblings().removeClass('bg-primary'); + + contactEl + .removeClass('unread') + .addClass('bg-primary') + .siblings().removeClass('bg-primary'); + components.get('chat/title').text(username); components.get('chat/messages').attr('data-uid', uid).attr('data-username', username); components.get('breadcrumb/current').text(username); diff --git a/src/socket.io/modules.js b/src/socket.io/modules.js index 7b6ed82778..42ac4092d2 100644 --- a/src/socket.io/modules.js +++ b/src/socket.io/modules.js @@ -27,6 +27,9 @@ SocketModules.chats.get = function(socket, data, callback) { since: data.since, isNew: false }, callback); + + // Mark chat as read + Messaging.markRead(socket.uid, data.touid); }; SocketModules.chats.getRaw = function(socket, data, callback) {