From 7f99b24e2822795045bff040e3754b7084d64438 Mon Sep 17 00:00:00 2001 From: Debanjana Sarkar Date: Fri, 8 Jul 2022 03:38:28 -0700 Subject: [PATCH] Fix for #2870 --- CHANGES.md | 5 +++-- src/plugins/chatview/tests/styling.js | 8 ++++++++ src/shared/styling.js | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 95ea897ce..1a889aa53 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,9 +11,10 @@ - Don't apply message corrections when the MUC occupant-id doesn't match. - Update `nick` attribute on ChatRoom when user nickname changes - Restrict editing of MUC messages to ones with the same XEP-0421 occupant ID -- #2936: Fix documentation about enable_smacks option, which is true by default. +- #2870: Fix for multiple URLs to be linkified when sent together in chat and adds a test for this. - #2925: Fix missing disco-items in browser storage. -- Fix MUC messages with a fallback body not rendering. +- #2936: Fix documentation about enable_smacks option, which is true by default. +- #3005: Fix MUC messages with a fallback body not rendering. ## 9.1.1 (2022-05-05) diff --git a/src/plugins/chatview/tests/styling.js b/src/plugins/chatview/tests/styling.js index 99fe26f53..a6f6ccb87 100644 --- a/src/plugins/chatview/tests/styling.js +++ b/src/plugins/chatview/tests/styling.js @@ -242,6 +242,14 @@ describe("An incoming chat Message", function () { await mock.openChatBoxFor(_converse, contact_jid); const view = _converse.chatboxviews.get(contact_jid); + msg_text = `> https://conversejs.org\n> https://conversejs.org`; + msg = mock.createChatMessage(_converse, contact_jid, msg_text) + await _converse.handleMessageStanza(msg); + await u.waitUntil(() => view.querySelectorAll('.chat-msg__text').length === 1); + msg_el = Array.from(view.querySelectorAll('converse-chat-message-body')).pop(); + await u.waitUntil(() => msg_el.innerHTML.replace(//g, '') === + '
https://conversejs.org \n https://conversejs.org
'); + msg_text = `> This is quoted text\n>This is also quoted\nThis is not quoted`; msg = mock.createChatMessage(_converse, contact_jid, msg_text) await _converse.handleMessageStanza(msg); diff --git a/src/shared/styling.js b/src/shared/styling.js index d0467a516..9c89ca9d8 100644 --- a/src/shared/styling.js +++ b/src/shared/styling.js @@ -145,7 +145,7 @@ export function getDirectiveTemplate (d, text, offset, options) { const template = styling_templates[styling_map[d].name]; if (isQuoteDirective(d)) { const newtext = text - .replace(/\n>/g, '\n') // Don't show the directive itself + .replace(/\n>/g, ' \n') // Don't show the directive itself .replace(/\n$/, ''); // Trim line-break at the end return template(newtext, offset, options); } else {