From 223c85e44e29b17ecace2508fb9b42f1894e709e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 10 Aug 2023 11:44:30 -0400 Subject: [PATCH] fix: if you send message scrollToBottom --- public/src/client/chats/messages.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/src/client/chats/messages.js b/public/src/client/chats/messages.js index 864b6e0604..fc875fea04 100644 --- a/public/src/client/chats/messages.js +++ b/public/src/client/chats/messages.js @@ -85,16 +85,16 @@ define('forum/chats/messages', [ } messages.parseMessage(data, function (html) { - onMessagesParsed(chatContentEl, html); + onMessagesParsed(chatContentEl, html, data); }); }; - function onMessagesParsed(chatContentEl, html) { + function onMessagesParsed(chatContentEl, html, msgData) { const newMessage = $(html); const isAtBottom = messages.isAtBottom(chatContentEl); newMessage.appendTo(chatContentEl); messages.onMessagesAddedToDom(newMessage); - if (isAtBottom) { + if (isAtBottom || msgData.self) { messages.scrollToBottom(chatContentEl); // remove some message elements if there are too many const chatMsgEls = chatContentEl.find('[data-mid]');