feat: resolve real names for message reactions when UI_Use_Real_Name is enabled#41574
feat: resolve real names for message reactions when UI_Use_Real_Name is enabled#41574Rohit3523 wants to merge 3 commits into
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: adae698 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (4)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2026-03-16T21:50:37.589ZApplied to files:
🔇 Additional comments (1)
Walkthrough
ChangesReaction Real-Name Mapping
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/meteor/tests/unit/server/lib/notifyListener.spec.ts (1)
105-126: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winAssert the deduplicated bulk lookup contract.
This fixture has no repeated username, and the stub ignores its arguments, so regressions to duplicate or per-reaction lookups still pass. Add a repeated username and assert one
findByUsernamescall with unique usernames and{ projection: { username: 1, name: 1 } }.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/meteor/tests/unit/server/lib/notifyListener.spec.ts` around lines 105 - 126, Update the “useRealName” reaction fixture to repeat a username across reactions, then assert the real-name lookup invokes findByUsernames exactly once with the deduplicated usernames and projection { username: 1, name: 1 }. Ensure the stub verifies its arguments so duplicate or per-reaction lookups fail the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/meteor/tests/unit/server/lib/notifyListener.spec.ts`:
- Around line 105-126: Update the “useRealName” reaction fixture to repeat a
username across reactions, then assert the real-name lookup invokes
findByUsernames exactly once with the deduplicated usernames and projection {
username: 1, name: 1 }. Ensure the stub verifies its arguments so duplicate or
per-reaction lookups fail the test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 66a43562-3f7f-441c-b327-a942d080d2e3
📒 Files selected for processing (2)
apps/meteor/server/lib/notifyListener.tsapps/meteor/tests/unit/server/lib/notifyListener.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
- GitHub Check: ⚙️ Variables Setup
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/server/lib/notifyListener.tsapps/meteor/tests/unit/server/lib/notifyListener.spec.ts
**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use.spec.tsextension for test files (e.g.,login.spec.ts)
Files:
apps/meteor/tests/unit/server/lib/notifyListener.spec.ts
🧠 Learnings (5)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/server/lib/notifyListener.tsapps/meteor/tests/unit/server/lib/notifyListener.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/server/lib/notifyListener.tsapps/meteor/tests/unit/server/lib/notifyListener.spec.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/server/lib/notifyListener.tsapps/meteor/tests/unit/server/lib/notifyListener.spec.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.
Applied to files:
apps/meteor/tests/unit/server/lib/notifyListener.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.
Applied to files:
apps/meteor/tests/unit/server/lib/notifyListener.spec.ts
🔇 Additional comments (2)
apps/meteor/server/lib/notifyListener.ts (1)
471-478: LGTM!apps/meteor/tests/unit/server/lib/notifyListener.spec.ts (1)
9-9: LGTM!Also applies to: 33-33, 49-49, 212-227
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #41574 +/- ##
===========================================
+ Coverage 68.69% 68.71% +0.01%
===========================================
Files 4139 4139
Lines 159112 159118 +6
Branches 27917 27883 -34
===========================================
+ Hits 109300 109333 +33
+ Misses 44666 44643 -23
+ Partials 5146 5142 -4
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Proposed changes
Resolves real names for message reactions in the broadcast pipeline. When
UI_Use_Real_Nameis enabled, the server now enriches each reaction with anamesarray containing the display names of users who reacted.Previously only the message author (
message.u.name) and mentions (mentions[].name) were resolved. This change extends the same pattern to reactions using a batch query (Users.findByUsernames) instead of per-username lookups.Issue(s)
https://rocketchat.atlassian.net/browse/NATIVE-1047
Steps to test or reproduce
Web
UI_Use_Real_Namein admin settingsMobile app
Further comments
Uses a single batch query (
Users.findByUsernames) to resolve all reaction usernames at once, deduplicated viaSet, with a fallback tousernamewhen a user has no display name set.Summary by CodeRabbit