From 82bfd6edfdeb43673549cf1f4fb72a208e694c8d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 4 Jan 2018 16:04:02 -0500 Subject: [PATCH] added a new component shortcut and updated title setting logic --- public/src/client/chats.js | 5 ++++- public/src/modules/components.js | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/public/src/client/chats.js b/public/src/client/chats.js index 2816f28c0f..39167db694 100644 --- a/public/src/client/chats.js +++ b/public/src/client/chats.js @@ -410,7 +410,10 @@ define('forum/chats', [ messages.onChatMessageEdit(); socket.on('event:chats.roomRename', function (data) { - $('[component="chat/room/name"]').val($('
').html(data.newName).text()); + var roomEl = components.get('chat/recent/room', data.roomId); + var titleEl = roomEl.find('[component="chat/title"]'); + + titleEl.text(data.newName); }); }; diff --git a/public/src/modules/components.js b/public/src/modules/components.js index 29d9e883a1..08454f21bc 100644 --- a/public/src/modules/components.js +++ b/public/src/modules/components.js @@ -50,9 +50,14 @@ define('components', function () { 'chat/message': function (messageId) { return $('[component="chat/message"][data-mid="' + messageId + '"]'); }, + 'chat/message/body': function (messageId) { return $('[component="chat/message"][data-mid="' + messageId + '"] [component="chat/message/body"]'); }, + + 'chat/recent/room': function (roomid) { + return $('[component="chat/recent/room"][data-roomid="' + roomid + '"]'); + }, }; components.get = function () {