Skip to content

Conversation

@juliajforesti
Copy link
Contributor

@juliajforesti juliajforesti commented Dec 15, 2025

CORE-1559

Proposed changes (including videos or screenshots)

  • unify UserAutoCompleteMultipleFederated and UserAutoCompleteMultiple
  • add federated flag to change behavior
  • remove hasExternalMembers validation on CreateChannelModal since it's not necessary anymore: the field will only show external users when federated flag is true

Issue(s)

closes #37809

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Fixed members tab "add members" to properly remove deselected items.
  • New Features / UX

    • Unified user picker across the app into a single component with federated support.
    • Selection inputs now surface actual error messages (not just presence).
  • Validation

    • Prevents adding external users to non‑federated rooms.
  • Tests

    • E2E tests updated to more reliable role‑based typing/selection interactions.
  • Chore

    • Added a changeset entry for a patch release.

✏️ Tip: You can customize this high-level summary in your review settings.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Dec 15, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Dec 15, 2025

🦋 Changeset detected

Latest commit: 5a9fae7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 42 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

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

@juliajforesti juliajforesti added this to the 7.14.0 milestone Dec 15, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 15, 2025

Walkthrough

Consolidates federated and non-federated user-autocomplete into a single UserAutoCompleteMultiple (adds federated prop), refactors it to use MultiSelectFiltered with selected-item caching and debounced queries, removes the federated-only component, updates callers, query keys, and E2E interactions.

Changes

Cohort / File(s) Summary
Changeset
/.changeset/cuddly-eels-perform.md
Adds changeset entry for a patch release documenting fix: "members tab > add members not removing selected items."
Core component refactor
apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultiple.tsx
Replaces AutoComplete UI with MultiSelectFiltered; introduces controlled value/onChange, placeholder, error, federated props; adds selectedCache, new option types, 500ms debounced user lookup via useEndpoint/useQuery, and renders selected items as avatar chips.
Removed federated variant
apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultipleFederated.tsx
Deletes the federated-specific component and its export.
Callers: modals & navbar
apps/meteor/client/NavBarV2/.../CreateChannelModal.tsx, apps/meteor/client/NavBarV2/.../CreateDirectMessage.tsx, apps/meteor/client/apps/gameCenter/GameCenterInvitePlayersModal.tsx, apps/meteor/client/sidebar/header/CreateChannel/CreateChannelModal.tsx, apps/meteor/client/sidebar/header/CreateDirectMessage.tsx
Swap imports/usages from federated-specific component to unified UserAutoCompleteMultiple; pass federated={...}; some callers remove or adjust previous external-member validation.
Room members / AddUsers
apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddUsers.tsx
Use unified UserAutoCompleteMultiple with computed isFederated; add Controller validation preventing external users in non-federated rooms; remove federated-specific import.
Audit tabs error handling
apps/meteor/client/views/audit/components/tabs/DirectTab.tsx, apps/meteor/client/views/audit/components/tabs/UsersTab.tsx
Change error prop passed to UserAutoCompleteMultiple from boolean (!!error) to the actual error message string (error?.message or undefined).
Query keys
apps/meteor/client/lib/queryKeys.ts
Add usersQueryKeys.userAutoComplete(filter: string, federated: boolean) to include federated flag in autocomplete query keys.
E2E tests & page objects
apps/meteor/tests/e2e/administration.spec.ts, apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts, apps/meteor/tests/e2e/page-objects/home-team.ts
Switch input interactions to pressSequentially() and change selectors to ARIA role-based queries (textbox, option) instead of previous XPath/CSS fills.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Focus review on:
    • UserAutoCompleteMultiple.tsx — selectedCache logic, add/remove handlers, value/onChange contract, options merging, and debounce/query key (federated) behavior.
    • Call sites where validation was removed or relocated (CreateChannelModal, AddUsers) — confirm intended policy and UX.
    • E2E test and page-object selector changes — verify stability across browsers/CI.

Possibly related PRs

Suggested reviewers

  • juliajforesti
  • aleksandernsilva
  • tassoevan

Poem

🐰
I hopped through code with eager paws,
Merged two lists and fixed those claws.
Chips now vanish when you click X,
Federated friends and local specs.
A rabbit cheers — selections bless!

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the primary fix: enabling removal of selected items from the UserAutoCompleteMultiple component.
Linked Issues check ✅ Passed The PR unifies federated and non-federated components by adding a federated prop, implements proper remove functionality for selected items, and addresses the core issue of users being unable to remove selected members.
Out of Scope Changes check ✅ Passed All changes are scoped to component unification and fixing the remove functionality. E2E test updates and query key additions directly support the refactoring and feature fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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/userAutoCompleteMultiple

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.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 15, 2025

📦 Docker Image Size Report

📈 Changes

Service Current Baseline Change Percent
sum of all images 1.2GiB 1.2GiB +12MiB
rocketchat 358MiB 347MiB +12MiB
omnichannel-transcript-service 132MiB 132MiB -996B
queue-worker-service 132MiB 132MiB -131B
ddp-streamer-service 126MiB 126MiB -2.7KiB
account-service 113MiB 113MiB +173B
authorization-service 111MiB 111MiB +548B
stream-hub-service 110MiB 110MiB +15B
presence-service 110MiB 110MiB -254B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/15 22:28", "11/16 01:28", "11/17 23:50", "11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 21:00", "12/04 18:17", "12/05 21:56", "12/08 20:15", "12/09 22:17", "12/10 23:26", "12/11 21:56", "12/12 22:45", "12/13 01:34", "12/15 22:31", "12/16 22:18", "12/17 21:04", "12/18 20:41", "12/18 21:51 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.14, 0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "queue-worker-service" [0.14, 0.14, 0.14, 0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13]
  line "rocketchat" [0.36, 0.36, 0.35, 0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.35]
  line "stream-hub-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
Loading

Statistics (last 24 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.2GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 1.2GiB
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-37823
  • Baseline: develop
  • Timestamp: 2025-12-18 21:51:23 UTC
  • Historical data points: 24

Updated: Thu, 18 Dec 2025 21:51:23 GMT

@juliajforesti juliajforesti force-pushed the fix/userAutoCompleteMultiple branch from a6731ba to d762778 Compare December 16, 2025 17:43
@juliajforesti juliajforesti force-pushed the fix/userAutoCompleteMultiple branch from 85ff404 to 864c52b Compare December 17, 2025 12:39
@juliajforesti juliajforesti force-pushed the fix/userAutoCompleteMultiple branch from 864c52b to a70b8aa Compare December 17, 2025 13:19
@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 63.41463% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.72%. Comparing base (5106fcd) to head (5a9fae7).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37823      +/-   ##
===========================================
- Coverage    67.72%   67.72%   -0.01%     
===========================================
  Files         3464     3464              
  Lines       113728   113713      -15     
  Branches     20908    20908              
===========================================
- Hits         77024    77008      -16     
- Misses       34527    34530       +3     
+ Partials      2177     2175       -2     
Flag Coverage Δ
e2e 57.21% <63.41%> (+0.03%) ⬆️
e2e-api 44.01% <ø> (+0.05%) ⬆️

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.

@juliajforesti juliajforesti marked this pull request as ready for review December 17, 2025 21:24
@juliajforesti juliajforesti requested a review from a team as a code owner December 17, 2025 21:24
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: 3

🧹 Nitpick comments (1)
apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts (1)

33-33: Consider explicit delay for consistency.

The pressSequentially call here doesn't specify a delay parameter, while the same pattern in home-team.ts (line 33) uses { delay: 100 }. Consider adding an explicit delay for consistent behavior across test interactions with autocomplete components.

-		await this.page.getByRole('textbox', { name: 'Choose users' }).pressSequentially(username);
+		await this.page.getByRole('textbox', { name: 'Choose users' }).pressSequentially(username, { delay: 100 });
📜 Review details

Configuration used: Organization 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 848af33 and 63312ab.

⛔ Files ignored due to path filters (1)
  • apps/meteor/client/sidebar/header/CreateTeam/__snapshots__/CreateTeamModal.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (14)
  • .changeset/cuddly-eels-perform.md (1 hunks)
  • apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/CreateChannelModal.tsx (2 hunks)
  • apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/CreateDirectMessage.tsx (2 hunks)
  • apps/meteor/client/apps/gameCenter/GameCenterInvitePlayersModal.tsx (2 hunks)
  • apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultiple.tsx (1 hunks)
  • apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultipleFederated.tsx (0 hunks)
  • apps/meteor/client/sidebar/header/CreateChannel/CreateChannelModal.tsx (2 hunks)
  • apps/meteor/client/sidebar/header/CreateDirectMessage.tsx (2 hunks)
  • apps/meteor/client/views/audit/components/tabs/DirectTab.tsx (1 hunks)
  • apps/meteor/client/views/audit/components/tabs/UsersTab.tsx (1 hunks)
  • apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddUsers.tsx (2 hunks)
  • apps/meteor/tests/e2e/administration.spec.ts (1 hunks)
  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts (1 hunks)
  • apps/meteor/tests/e2e/page-objects/home-team.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultipleFederated.tsx
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{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/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/client/views/audit/components/tabs/DirectTab.tsx
  • apps/meteor/tests/e2e/administration.spec.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
  • apps/meteor/client/sidebar/header/CreateDirectMessage.tsx
  • apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/CreateChannelModal.tsx
  • apps/meteor/client/sidebar/header/CreateChannel/CreateChannelModal.tsx
  • apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddUsers.tsx
  • apps/meteor/client/views/audit/components/tabs/UsersTab.tsx
  • apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultiple.tsx
  • apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/CreateDirectMessage.tsx
  • apps/meteor/client/apps/gameCenter/GameCenterInvitePlayersModal.tsx
apps/meteor/tests/e2e/page-objects/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

Utilize existing page objects pattern from apps/meteor/tests/e2e/page-objects/

Files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
apps/meteor/tests/e2e/**/*.{ts,spec.ts}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.{ts,spec.ts}: Store commonly used locators in variables/constants for reuse
Follow Page Object Model pattern consistently in Playwright tests

Files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/administration.spec.ts
  • apps/meteor/tests/e2e/page-objects/home-team.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.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.spec.ts: All test files must be created in apps/meteor/tests/e2e/ directory
Avoid using page.locator() in Playwright tests - always prefer semantic locators such as page.getByRole(), page.getByLabel(), page.getByText(), or page.getByTitle()
Use test.beforeAll() and test.afterAll() for setup/teardown in Playwright tests
Use test.step() for complex test scenarios to improve organization in Playwright tests
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) for consistency in test files
Prefer web-first assertions (toBeVisible, toHaveText, etc.) in Playwright tests
Use expect matchers for assertions (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements in Playwright tests
Use page.waitFor() with specific conditions instead of hardcoded timeouts in Playwright tests
Implement proper wait strategies for dynamic content in Playwright tests
Maintain test isolation between test cases in Playwright tests
Ensure clean state for each test execution in Playwright tests
Ensure tests run reliably in parallel without shared state conflicts

Files:

  • apps/meteor/tests/e2e/administration.spec.ts
🧠 Learnings (19)
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Avoid using `page.locator()` in Playwright tests - always prefer semantic locators such as `page.getByRole()`, `page.getByLabel()`, `page.getByText()`, or `page.getByTitle()`

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/administration.spec.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/administration.spec.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/administration.spec.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Store commonly used locators in variables/constants for reuse

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
📚 Learning: 2025-09-23T19:22:59.217Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 36987
File: apps/meteor/tests/e2e/page-objects/fragments/room-toolbar.ts:10-20
Timestamp: 2025-09-23T19:22:59.217Z
Learning: In Playwright e2e tests, prefer stable selectors like data-qa-id attributes over localized text in getByRole() or getByText() calls to prevent test failures when UI language changes. Test translations separately by validating actual text content after ensuring UI interactions work with stable selectors.

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/administration.spec.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Prefer web-first assertions (`toBeVisible`, `toHaveText`, etc.) in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Implement proper wait strategies for dynamic content in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/administration.spec.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
📚 Learning: 2025-12-16T17:29:40.430Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37834
File: apps/meteor/tests/e2e/page-objects/fragments/admin-flextab-emoji.ts:12-22
Timestamp: 2025-12-16T17:29:40.430Z
Learning: In all page-object files under apps/meteor/tests/e2e/page-objects/, import expect from ../../utils/test (Playwright's async expect) instead of from Jest. Jest's expect is synchronous and incompatible with web-first assertions like toBeVisible, which can cause TypeScript errors.

Applied to files:

  • apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts
  • apps/meteor/tests/e2e/page-objects/home-team.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory

Applied to files:

  • apps/meteor/tests/e2e/administration.spec.ts
📚 Learning: 2025-09-19T15:15:04.642Z
Learnt from: rodrigok
Repo: RocketChat/Rocket.Chat PR: 36991
File: apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Settings.ts:219-221
Timestamp: 2025-09-19T15:15:04.642Z
Learning: The Federation_Matrix_homeserver_domain setting in apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Settings.ts is part of the old federation system and is being deprecated/removed, so configuration issues with this setting should not be flagged for improvement.

Applied to files:

  • apps/meteor/client/sidebar/header/CreateDirectMessage.tsx
  • apps/meteor/client/sidebar/header/CreateChannel/CreateChannelModal.tsx
  • apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddUsers.tsx
📚 Learning: 2025-10-28T16:53:42.761Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.

Applied to files:

  • apps/meteor/client/sidebar/header/CreateDirectMessage.tsx
  • apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/CreateChannelModal.tsx
  • apps/meteor/client/sidebar/header/CreateChannel/CreateChannelModal.tsx
  • apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddUsers.tsx
  • apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/CreateDirectMessage.tsx
📚 Learning: 2025-11-04T16:49:19.107Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37377
File: apps/meteor/ee/server/hooks/federation/index.ts:86-88
Timestamp: 2025-11-04T16:49:19.107Z
Learning: In Rocket.Chat's federation system (apps/meteor/ee/server/hooks/federation/), permission checks follow two distinct patterns: (1) User-initiated federation actions (creating rooms, adding users to federated rooms, joining from invites) should throw MeteorError to inform users they lack 'access-federation' permission. (2) Remote server-initiated federation events should silently skip/ignore when users lack permission. The beforeAddUserToRoom hook only executes for local user-initiated actions, so throwing an error there is correct. Remote federation events are handled separately by the federation Matrix package with silent skipping logic.

Applied to files:

  • apps/meteor/client/sidebar/header/CreateChannel/CreateChannelModal.tsx
  • .changeset/cuddly-eels-perform.md
  • apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddUsers.tsx
🧬 Code graph analysis (1)
apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultiple.tsx (1)
apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultipleOptions.tsx (1)
  • OptionsContext (22-24)
🔇 Additional comments (18)
apps/meteor/tests/e2e/page-objects/fragments/home-flextab-members.ts (1)

33-34: Excellent migration to semantic role-based selectors.

The shift from locator-based selectors to getByRole('textbox') and getByRole('option') aligns with Playwright best practices and improves test stability. Using pressSequentially instead of fill is appropriate for autocomplete components that filter results as users type.

Based on coding guidelines: "Avoid using page.locator() in Playwright tests - always prefer semantic locators such as page.getByRole()".

apps/meteor/tests/e2e/administration.spec.ts (1)

314-314: LGTM: Appropriate change for autocomplete interaction.

Switching from fill to pressSequentially correctly simulates character-by-character typing, which triggers the autocomplete filtering logic in the new UserAutoCompleteMultiple component. This aligns with the updated page object patterns.

Note: For consistency with home-team.ts line 33, consider adding { delay: 100 } if test flakiness occurs due to rapid typing.

apps/meteor/tests/e2e/page-objects/home-team.ts (1)

33-34: Strong improvement: semantic selectors replace brittle CSS selectors.

The migration from CSS class selectors (.rcx-option__content) and string-based role locators to proper getByRole calls significantly improves test maintainability. The explicit { delay: 100 } parameter in pressSequentially provides consistent typing behavior for the autocomplete component.

Note: Consider standardizing the delay parameter across similar interactions in home-flextab-members.ts line 33 and administration.spec.ts line 314, which currently don't specify an explicit delay.

Based on coding guidelines: "Avoid using page.locator() - always prefer semantic locators" and "Store commonly used locators in variables/constants for reuse."

.changeset/cuddly-eels-perform.md (1)

1-5: LGTM! Changeset properly documents the bugfix.

The changeset correctly specifies a patch version for the bugfix and clearly describes the issue being resolved.

apps/meteor/client/apps/gameCenter/GameCenterInvitePlayersModal.tsx (1)

9-9: LGTM! Migration to unified component is correct.

The import path and component usage are properly updated to use the generalized UserAutoCompleteMultiple with the federated prop enabled.

Also applies to: 60-60

apps/meteor/client/views/audit/components/tabs/DirectTab.tsx (1)

36-36: LGTM! Error prop correctly updated to string type.

The change from a boolean error indicator to passing the actual error message (usersFieldState.error?.message) aligns with the updated UserAutoCompleteMultiple API and provides better error context.

apps/meteor/client/sidebar/header/CreateDirectMessage.tsx (1)

23-23: LGTM! Migration preserves all functionality and accessibility.

The import and component usage are properly updated. The federated prop enables federated user selection, and all accessibility attributes (aria-describedby, aria-required, aria-invalid) are correctly maintained.

Also applies to: 79-90

apps/meteor/client/views/room/contextualBar/RoomMembers/AddUsers/AddUsers.tsx (1)

40-40: LGTM! Excellent refactoring with improved validation.

The migration to the unified component simplifies the code by removing conditional rendering. The added validation rule correctly prevents external users from being added to non-federated rooms, improving data integrity.

Also applies to: 76-90

apps/meteor/client/views/audit/components/tabs/UsersTab.tsx (1)

35-35: LGTM! Error handling updated consistently.

The error prop change from boolean to string message is consistent with the updated component API and matches the pattern used in DirectTab.tsx.

apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/CreateChannelModal.tsx (1)

37-37: LGTM! Migration with proper validation.

The component migration is correct, with the federated prop properly connected to form state. The validation rule correctly prevents external members from being added to non-federated channels, maintaining data integrity.

Also applies to: 255-270

apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/CreateDirectMessage.tsx (1)

23-23: LGTM! Consistent migration preserving accessibility.

The import and component usage are properly updated, mirroring the sidebar version. The federated prop enables federated user selection, and all accessibility attributes are correctly maintained.

Also applies to: 81-92

apps/meteor/client/sidebar/header/CreateChannel/CreateChannelModal.tsx (2)

37-37: LGTM!

The import path correctly references the unified UserAutoCompleteMultiple component, aligning with the PR objective to consolidate federated and non-federated functionality.


260-266: LGTM!

The component integration is correct. The federated prop properly controls the component's behavior based on the form state, and the Controller integration with react-hook-form is appropriate.

apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultiple.tsx (5)

1-9: LGTM!

The imports correctly reflect the component's transition from AutoComplete to MultiSelectFiltered and include all necessary dependencies for the new implementation.


11-27: LGTM!

The type definitions are well-structured and accurately model the component's data requirements, including support for federated users.


29-35: LGTM!

The regex pattern correctly matches Matrix federation format, and the debounce interval of 500ms provides a good balance between responsiveness and API call frequency.


36-55: LGTM!

The data fetching implementation is solid. The queryKey correctly includes the federated flag for cache separation, and the conditional injection of federated users based on the Matrix pattern is appropriate. The use of keepPreviousData prevents UI flickering during refetches.


70-78: LGTM!

The onRemoveUser callback correctly maintains immutability when removing users from the cache.

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: 1

♻️ Duplicate comments (3)
apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultiple.tsx (3)

60-69: Throwing on cache miss can crash the component.

As noted in the previous review, throwing an error when a user is not found could crash the component during race conditions or when dealing with stale data. Defensive error handling with a warning would be more resilient.


81-91: Only processing the first added/removed username.

As previously noted, the current logic only handles the first added and first removed username via [0]. If multiple usernames are added or removed (e.g., programmatically or via paste), the remaining items won't be properly cached or uncached, leading to display issues.


120-120: Options list can contain duplicates.

As noted in the previous review, concatenating fetched options with selectedCache entries can create duplicate username entries in the dropdown when a selected user also appears in search results.

📜 Review details

Configuration used: Organization 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 63312ab and 87f33eb.

📒 Files selected for processing (2)
  • apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultiple.tsx (1 hunks)
  • apps/meteor/client/lib/queryKeys.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{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/client/lib/queryKeys.ts
  • apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultiple.tsx
🧬 Code graph analysis (1)
apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultiple.tsx (2)
apps/meteor/client/lib/queryKeys.ts (1)
  • usersQueryKeys (122-127)
apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultipleOptions.tsx (1)
  • OptionsContext (22-24)
⏰ 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 (3)
apps/meteor/client/lib/queryKeys.ts (1)

126-126: LGTM! Query key factory follows established patterns.

The new userAutoComplete key factory is consistent with the existing query key structure and properly typed with as const. The inclusion of both filter and federated parameters ensures proper cache segmentation for different autocomplete contexts.

apps/meteor/client/components/UserAutoCompleteMultiple/UserAutoCompleteMultiple.tsx (2)

12-28: Type definitions are clear and well-structured.

The prop types correctly reflect the multi-select behavior with Array<string> for value and onChange, and the internal cache types (UserAutoCompleteOptionType and UserAutoCompleteOptions) properly support the selected-item caching strategy.


36-58: Data fetching logic is well-implemented.

The 500ms debounce provides good balance between responsiveness and API call reduction. The use of keepPreviousData prevents UI flicker during re-queries, and the federated user injection logic correctly adds synthetic options for Matrix-pattern usernames.

@MartinSchoeler MartinSchoeler added the stat: QA assured Means it has been tested and approved by a company insider label Dec 18, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Dec 18, 2025
@kodiakhq kodiakhq bot merged commit 9fb60f2 into develop Dec 18, 2025
48 checks passed
@kodiakhq kodiakhq bot deleted the fix/userAutoCompleteMultiple branch December 18, 2025 22:13
gaolin1 pushed a commit to gaolin1/medsense.webchat that referenced this pull request Jan 6, 2026
@dougfabris dougfabris modified the milestones: 7.14.0, 8.0.0 Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Channel: selected members are not visually distinguishable

4 participants