Repository navigation
fix(chat): preserve text before links in reply message preview - #25268
ramonlsouza merged 1 commit into
Conversation
The reply intention preview and the quote inside sent replies extract the first visible line of the original message with getFirstVisibleLineHtml. The function treated the inline tags <a> and <code> as block-level, walked the root children in reverse order and removed every node that precedes the last "block" found - so a message like "Hello https://example.com" was previewed as just the link. Rewrite the extraction to walk the DOM in document order and truncate at the first visual line break (newline in a non-whitespace-only text node, <br>, or the end of the first nested block element), keeping inline content of the first line intact. Lists now preview their first item instead of the last one. Add an e2e scenario covering both previews when replying to a message with text followed by a link. Co-authored-by: Tainan Felipe <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughThe PR fixes a bug where the chat reply preview omits text appearing before a link in a message. The Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🚨 Automated tests failed |
ramonlsouza
left a comment
There was a problem hiding this comment.
tested locally and it looks good! the failing tests are unrelated to the changes made in this pull request
64b3e59
into
bigbluebutton:v4.0.x-develop



What does this PR do?
Fixes the chat reply preview dropping text that comes before a link.
When you reply to a message like
Hello https://example.com, both previews — the "replying to" banner above the input and the quote inside the sent reply — showed onlyhttps://example.com, silently dropping theHello.The culprit is
getFirstVisibleLineHtml(bigbluebutton-html5/.../chat/chat-graphql/service.ts), which extracts the first line of the original message. It walked the message's nodes in reverse and treated the inline tags<a>and<code>as block-level, so it kept the last block (the link) and removed everything before it. This also affected text before inline code, text on both sides of a link, and lists (showed the last item instead of the first).The fix rewrites the extraction to walk the DOM in document order and truncate at the first real line break (a
\nin a text node, a<br>, or the end of the first block element), keeping all inline content of the first line intact.Closes Issue(s)
Closes #25251
How to test
Hello https://example.comHello https://example.com, not just the linkHello https://example.comAutomated:
npx playwright test chat/chat.spec.ts --grep "Reply to a message with text followed by a link"(new scenario covering both previews).