Skip to content

Conversation

@ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented Oct 3, 2025

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Better user mention recognition to match usernames with or without “@”.
    • Excludes team entries and missing usernames from mention resolution for more accurate linking.
    • Normalized popup selection values to ensure consistent username handling.
    • Consistent channel mention parsing that strips prefixes reliably.
    • Preserves mentions containing colons to keep intended text.
  • Chores

    • Internal consistency updates to mention parsing across components for improved reliability.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 3, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Oct 3, 2025

⚠️ No Changeset found

Latest commit: e30344a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Server and client mention handling were normalized: server now trims or strips mention prefixes conditionally; client-side mention resolution and composer popup normalize usernames by removing a leading @, and client resolution excludes missing usernames and team entries.

Changes

Cohort / File(s) Change Summary
Server mention parsing
apps/meteor/app/mentions/server/Mentions.ts
Parse user mentions: if token contains : keep trimmed string; otherwise trim and remove leading character via substring(1). Channel mention prefix stripping now uses substring(1) instead of substr(1).
Client mention resolution
apps/meteor/client/components/GazzodownText.tsx
resolveUserMention normalizes incoming mention by stripping leading @, normalizes candidate usernames by stripping leading @ when present, excludes entries with missing username or type === 'team', and compares normalized usernames; team-resolution branch unchanged.
Composer popup normalization
apps/meteor/client/views/room/providers/ComposerPopupProvider.tsx
Composer popup getValue now sanitizes usernames by removing a leading @ if present; rendering and other behavior unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant C as Client (Composer/Renderer)
  participant R as Resolver (GazzodownText)
  participant S as Server (Mentions)

  U->>C: Type/select @mention
  C->>C: Normalize selected value (strip leading "@")
  C->>R: Resolve mention token
  R->>R: Normalize mention (strip "@")\nFilter out entries with missing username or type 'team'\nCompare normalized usernames
  R-->>C: Resolved mention metadata
  C->>S: Send message with mention tokens
  S->>S: Parse mentions:\n- If token contains ':' -> keep trimmed\n- Else -> trim and substring(1)
  S-->>C: Parsed mentions acknowledged
  C-->>U: Render message with resolved mentions
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • ggazzo

Poem

A rabbit taps the @ with glee,
Trims the tails so names run free.
Teams hop past, users stay,
Normalized, they find their way.
Bun winks: "Mentions fixed!" 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately reflects the primary change by indicating that federation mentions were previously rendered as plain text on the Rocket.Chat side and now require fixing, and it concisely conveys the scope of the update without extraneous detail.
Linked Issues Check ✅ Passed The code updates adjust both server and client mention handling to preserve federated mention tokens containing colons and normalize usernames by stripping leading '@', which directly addresses the FDR-138 objective of correctly detecting and applying federated user mentions to trigger notifications.
Out of Scope Changes Check ✅ Passed All modifications are confined to mention token parsing and normalization logic in the relevant server and client modules, aligning with the federation mention fix and without introducing any unrelated functionality.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/federation-mentions

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 29ed515 and e30344a.

📒 Files selected for processing (3)
  • apps/meteor/app/mentions/server/Mentions.ts (2 hunks)
  • apps/meteor/client/components/GazzodownText.tsx (1 hunks)
  • apps/meteor/client/views/room/providers/ComposerPopupProvider.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/meteor/client/components/GazzodownText.tsx
  • apps/meteor/app/mentions/server/Mentions.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (1)
apps/meteor/client/views/room/providers/ComposerPopupProvider.tsx (1)

156-156: Approve username normalization in ComposerPopupProvider

The conditional correctly handles federated usernames (e.g. “@user:server.com”) by stripping the leading “@” so the autocomplete inserts the proper local part, and it’s a no-op for standard usernames.


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.

@codecov
Copy link

codecov bot commented Oct 4, 2025

Codecov Report

❌ Patch coverage is 44.44444% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.35%. Comparing base (76fde8d) to head (e30344a).
⚠️ Report is 2 commits behind head on release-7.11.0.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-7.11.0   #37140      +/-   ##
==================================================
- Coverage           66.36%   66.35%   -0.02%     
==================================================
  Files                3386     3386              
  Lines              115661   115666       +5     
  Branches            21362    21360       -2     
==================================================
- Hits                76761    76746      -15     
- Misses              36295    36314      +19     
- Partials             2605     2606       +1     
Flag Coverage Δ
e2e 57.30% <50.00%> (+0.03%) ⬆️
unit 71.18% <12.50%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ricardogarim ricardogarim force-pushed the fix/federation-mentions branch from a6fae0b to a46c7a4 Compare October 6, 2025 12:39
@ricardogarim ricardogarim marked this pull request as ready for review October 6, 2025 12:40
@ricardogarim ricardogarim requested a review from a team as a code owner October 6, 2025 12:40
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/meteor/app/mentions/server/Mentions.ts (1)

57-57: Clarify federated mention logic.
Add a comment at line 57 noting that m.includes(':') detects federated usernames (e.g. @user:server) which must be kept intact, while other mentions strip the leading @. The substring(1) call is safe since the regex ensures non-empty matches.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ab8b431 and a46c7a4.

📒 Files selected for processing (3)
  • apps/meteor/app/mentions/server/Mentions.ts (2 hunks)
  • apps/meteor/client/components/GazzodownText.tsx (1 hunks)
  • apps/meteor/client/views/room/providers/ComposerPopupProvider.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: 🔨 Test Unit / Unit Tests
  • GitHub Check: 🔨 Test Storybook / Test Storybook
  • GitHub Check: 🔎 Code Check / Code Lint
  • GitHub Check: 🔎 Code Check / TypeScript
  • GitHub Check: 📦 Meteor Build - coverage
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (3)
apps/meteor/client/views/room/providers/ComposerPopupProvider.tsx (1)

156-156: Username normalization consistency

ComposerPopupProvider.tsx now strips leading ‘@’ from item.username just like in GazzodownText.tsx; no other getValue(username) patterns were found. Verify this covers all mention scenarios (e.g., federated usernames).

apps/meteor/client/components/GazzodownText.tsx (1)

69-74: Verify team mention normalization
Confirm whether UserMention.name includes a leading “@”. If it doesn’t, either strip “@” from mention in filterTeam or normalize name before comparison to ensure team mentions match correctly.

apps/meteor/app/mentions/server/Mentions.ts (1)

82-82: Approve prefix stripping for channel mentions. The .substring(1) call correctly removes the # prefix for both local (#general) and federated (#room@server) mentions.

@ricardogarim ricardogarim force-pushed the fix/federation-mentions branch from a46c7a4 to 9e9dcbd Compare October 6, 2025 18:00
@ggazzo ggazzo force-pushed the chore/fed-branded branch 7 times, most recently from 6fc8f40 to 928973e Compare October 8, 2025 02:36
@ggazzo ggazzo requested review from a team as code owners October 8, 2025 02:36
@ggazzo ggazzo force-pushed the chore/fed-branded branch 5 times, most recently from 89ebe54 to 94445d8 Compare October 8, 2025 02:47
Base automatically changed from chore/fed-branded to release-7.11.0 October 8, 2025 03:42
@ggazzo ggazzo force-pushed the fix/federation-mentions branch from 9e9dcbd to 29ed515 Compare October 8, 2025 03:44
@rodrigok rodrigok force-pushed the fix/federation-mentions branch from 29ed515 to e30344a Compare October 9, 2025 23:28
@rodrigok rodrigok merged commit 510f42f into release-7.11.0 Oct 10, 2025
87 of 89 checks passed
@rodrigok rodrigok deleted the fix/federation-mentions branch October 10, 2025 01:18
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