From 15d2119f38fede1500803b3b0613b062bdbdfa7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 28 Aug 2023 16:40:42 -0400 Subject: [PATCH] show parent message in pinned messages --- public/src/client/chats.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/src/client/chats.js b/public/src/client/chats.js index 63f605987b..8ff02d6bc3 100644 --- a/public/src/client/chats.js +++ b/public/src/client/chats.js @@ -86,7 +86,7 @@ define('forum/chats', [ Chats.addDeleteHandler(roomId, chatControls.find('[data-action="delete"]')); Chats.addScrollHandler(roomId, ajaxify.data.uid, chatMessageContent); Chats.addScrollBottomHandler(chatMessageContent); - Chats.addParentHandler(chatMessageContent); + Chats.addParentHandler(mainWrapper); Chats.addCharactersLeftHandler(mainWrapper); Chats.addTextareaResizeHandler(mainWrapper); Chats.addIPHandler(mainWrapper); @@ -173,12 +173,13 @@ define('forum/chats', [ }); }); }; - Chats.addParentHandler = function (chatContent) { - chatContent.on('click', '[component="chat/message/parent"]', function () { + Chats.addParentHandler = function (mainWrapper) { + mainWrapper.on('click', '[component="chat/message/parent"]', function () { const parentEl = $(this); parentEl.find('[component="chat/message/parent/content"]').toggleClass('line-clamp-1'); parentEl.find('.chat-timestamp').toggleClass('hidden'); parentEl.toggleClass('flex-column').toggleClass('flex-row'); + const chatContent = parentEl.parents('[component="chat/message/content"]'); if (chatContent.length && messages.isAtBottom(chatContent)) { messages.scrollToBottom(chatContent); }