Skip to content

Node.js based forum software built for the modern web

Chat fixes

Julian Lam8f5dccdfb521
diff --git a/public/src/client/chats.js b/public/src/client/chats.js
index 911c12f7cb..cee14a516e 100644
--- a/public/src/client/chats.js
+++ b/public/src/client/chats.js
@@ -471,7 +471,7 @@ define('forum/chats', [
data.message.self = data.self;
messages.appendChatMessage($('.expanded-chat .chat-content'), data.message);
- } else if (ajaxify.currentPage.startsWith('chats')) {
+ } else if (ajaxify.data.template.chats) {
var roomEl = $('[data-roomid=' + data.roomId + ']');
if (roomEl.length > 0) {
@@ -503,6 +503,7 @@ define('forum/chats', [
socket.on('event:chats.roomRename', function (data) {
var roomEl = components.get('chat/recent/room', data.roomId);
var titleEl = roomEl.find('[component="chat/title"]');
+ ajaxify.data.roomName = data.newName;
titleEl.text(data.newName);
});
@@ -519,6 +520,7 @@ define('forum/chats', [
Chats.setActive = function () {
if (ajaxify.data.roomId) {
socket.emit('modules.chats.markRead', ajaxify.data.roomId);
+ $('[data-roomid="' + ajaxify.data.roomId + '"]').toggleClass('unread', false);
$('.expanded-chat input').focus();
}
$('.chats-list li').removeClass('bg-info');
diff --git a/public/src/client/chats/recent.js b/public/src/client/chats/recent.js
index 7d6f16211a..32156cfc8f 100644
--- a/public/src/client/chats/recent.js
+++ b/public/src/client/chats/recent.js
@@ -6,11 +6,6 @@ define('forum/chats/recent', function () {
recent.init = function () {
require(['forum/chats'], function (Chats) {
- $('[component="chat/recent"]').on('click', '[component="chat/leave"]', function () {
- Chats.leave($(this).parents('[data-roomid]'));
- return false;
- });
-
$('[component="chat/recent"]').on('click', '[component="chat/recent/room"]', function () {
Chats.switchChat($(this).attr('data-roomid'));
});
diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js
index d493e3aa2d..fadd1d6f82 100644
--- a/public/src/modules/chat.js
+++ b/public/src/modules/chat.js
@@ -106,7 +106,7 @@ define('chat', [
socket.on('event:chats.roomRename', function (data) {
var newTitle = $('<div/>').html(data.newName).text();
var modal = module.getModal(data.roomId);
- modal.find('[component="chat/room/name"]').val(newTitle);
+ modal.find('[component="chat/room/name"]').text(newTitle);
taskbar.updateTitle('chat', modal.attr('UUID'), newTitle);
});