Skip to content

fix(chat): preserve text before links in reply message preview - #25274

Merged
ramonlsouza merged 1 commit into
bigbluebutton:v3.0.x-developfrom
ramonlsouza:bp-25268
Jun 18, 2026
Merged

ramonlsouza merged 1 commit into
bigbluebutton:v3.0.x-developfrom
ramonlsouza:bp-25268

Conversation

@ramonlsouza

Copy link
Copy Markdown
Member

What does this PR do?

ports #25268 changes to BBB 3.0:

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 only https://example.com, silently dropping the Hello.

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 \n in a text node, a <br>, or the end of the first block element), keeping all inline content of the first line intact.

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]>
@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d8e53cb4-df76-448b-a633-3cae796e27e8

📥 Commits

Reviewing files that changed from the base of the PR and between 7fe4f3b and 1531aa4.

📒 Files selected for processing (4)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/service.ts
  • bigbluebutton-tests/playwright/chat/chat.spec.ts
  • bigbluebutton-tests/playwright/chat/messageActions.ts
  • bigbluebutton-tests/playwright/core/elements.ts

Walkthrough

A new truncateAtFirstLineBreak DOM-mutating helper is introduced in service.ts to replace the previous displayBlockTags/keptBlocks block-tag traversal in getFirstVisibleLineHtml. The helper recursively walks the DOM tree, truncating text nodes at the first newline, removing <br> elements, and deleting siblings that follow the first detected line break inside block-level elements. The Playwright test suite gains a messageWithTextBeforeLink constant (Hello https://example.com), a new replyMessageWithTextBeforeLink method in MessageActions, and a corresponding test case that asserts both the reply intention preview and the quoted reply preserve the complete first line.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: preserving text before links in chat reply message previews, which is the core objective of this PR.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the bug, root cause, and the fix with sufficient detail.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@antobinary antobinary added this to the Release 3.0 milestone Jun 16, 2026
@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@ramonlsouza
ramonlsouza merged commit 9751279 into bigbluebutton:v3.0.x-develop Jun 18, 2026
86 of 88 checks passed
@sonarqubecloud

Copy link
Copy Markdown

@ramonlsouza ramonlsouza mentioned this pull request Jun 19, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants