Skip to content

Conversation

@Shreyas2004wagh
Copy link

Fixes #1136

Summary

This PR aligns EmbeddedChat mention rendering with Rocket.Chat core for wrapped mentions.

When the parser emits MENTION_USER tokens for values like (@user), EmbeddedChat currently renders them with mention styling. Rocket.Chat core renders the same pattern as plain text. This change keeps parser behavior unchanged and applies a conservative render-time rule so wrapped mentions are displayed as plain text.

This preserves deterministic behavior and avoids parser-side risk.

Acceptance Criteria fulfillment

  • Wrapped user mentions (e.g. (@user)) are rendered as plain text
  • Normal mentions (e.g. @user) continue to render as mentions
  • Parser behavior is unchanged (render-scoped fix only)

PR Test Details

  • yarn workspace @embeddedchat/markups test src/elements/InlineElements.test.js --runInBand
  • yarn workspace @embeddedchat/markups build

Notes

I've validated this behavior locally; this PR applies the same render-scoped approach to ensure compatibility with Rocket.Chat core.

Copilot AI review requested due to automatic review settings February 8, 2026 13:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the @embeddedchat/markups rendering layer to match Rocket.Chat core behavior by displaying wrapped user mentions like (@user) as plain text (no mention styling), while keeping normal mentions like @user styled as mentions.

Changes:

  • Add a render-time rule in InlineElements to treat MENTION_USER tokens surrounded by ( and ) (with optional whitespace) as plain text.
  • Add unit tests covering wrapped vs. normal mention rendering behavior.
  • Add Jest/Babel test configuration and a test script for the @embeddedchat/markups workspace package.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/markups/src/elements/InlineElements.js Detects (@user)-style wrapped mentions and renders them using PlainSpan instead of UserMention.
packages/markups/src/elements/InlineElements.test.js Adds tests ensuring wrapped mentions render as plain text and unwrapped mentions remain styled.
packages/markups/jest.config.js Introduces a Jest config for the markups package (Node environment + babel-jest transform).
packages/markups/babel.config.js Adds a test-only Babel config adjustment for Jest runs.
packages/markups/package.json Adds a test script to run Jest in the workspace.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +25
env: {
test: {
presets: [
[
'@babel/preset-env',
{
modules: 'commonjs',
},
],
],
},
},
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env.test.presets adds a second @babel/preset-env on top of the top-level presets, so preset-env will run twice with different modules settings. To keep test/build transforms simpler and more predictable, consider conditionally configuring the existing preset-env (e.g., function export + api.env('test')) or using @babel/plugin-transform-modules-commonjs for tests instead of introducing a second preset-env.

Copilot uses AI. Check for mistakes.
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.

Inconsistent Mention Parsing between EmbeddedChat and Rocket.Core Chat

1 participant