From 4728e3808e6cb6821010ea106ad295e4ef69baa1 Mon Sep 17 00:00:00 2001 From: zr0w1 Date: Tue, 10 Dec 2024 08:54:21 -0500 Subject: [PATCH] fix shortlinks being broken in user info menu --- assets/chat/js/menus/ChatUserInfoMenu.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/assets/chat/js/menus/ChatUserInfoMenu.js b/assets/chat/js/menus/ChatUserInfoMenu.js index ccb7fe34..57b6c9ee 100644 --- a/assets/chat/js/menus/ChatUserInfoMenu.js +++ b/assets/chat/js/menus/ChatUserInfoMenu.js @@ -359,10 +359,18 @@ export default class ChatUserInfoMenu extends ChatMenuFloating { nextMsg = nextMsg.next('.msg-continue'); } this.messageArray.forEach((element) => { - const text = element.find('.text')[0].innerText; + const textContainer = element.find('.text')[0]; + let rawText = ''; + for (const node of textContainer.childNodes) { + if (node instanceof HTMLAnchorElement) { + rawText += node.href; + } else { + rawText += node.textContent; + } + } // Create a new `ChatUser` to remove username styles for a cleaner look. - const msg = MessageBuilder.message(text, new ChatUser(nick)); + const msg = MessageBuilder.message(rawText, new ChatUser(nick)); displayedMessages.push(msg.html(this.chat)); }); }