Skip to content

feat(sidebar): add Teams and channels merged category#40750

Open
ggazzo wants to merge 3 commits into
developfrom
feat/sidebar-teams-channels-merge
Open

feat(sidebar): add Teams and channels merged category#40750
ggazzo wants to merge 3 commits into
developfrom
feat/sidebar-teams-channels-merge

Conversation

@ggazzo
Copy link
Copy Markdown
Member

@ggazzo ggazzo commented Jun 1, 2026

Proposed changes

Adds two opt-in sidebar grouping user preferences to the legacy sidebar (useRoomList, feature secondarySidebar OFF). The new navigation (RoomsNavigationProvider) is intentionally untouched — different grouping model, handled separately.

1. sidebarGroupTeamsAndChannels — merged category

When Group by type is enabled and this preference is on, the Teams and Channels groups merge into a single "Teams and channels" category.

  • Only applies when sidebarGroupByType is enabled.
  • Separate Teams/Channels groups are not rendered while merged.
  • Empty merged group is hidden (size guard).
  • The Teams_and_channels key is injected for users whose saved sidebarSectionsOrder predates it, so the group renders without a migration.

2. sidebarGroupUnlistedInConversations — catch-all for hidden groups

Today, when a routable group (Teams, Channels, Discussions, Direct messages, Teams and channels) is removed from the visible sidebar sections, its rooms disappear from the sidebar. With this preference on, those rooms are routed into the "Conversations" group instead of being dropped.

  • Only applies when sidebarGroupByType is enabled.
  • Override buckets (Unread, Drafts, Favorites) and system groups (omnichannel, incoming calls) are excluded from routing.
  • Rooms are deduplicated by reference; Conversations is ensured in the render order when it receives routed rooms.

Changes

  • useRoomList.ts — merge logic, unlisted-group routing, section-order handling.
  • accounts.ts — default preference settings + Teams_and_channels in the default sections order.
  • saveUserPreferences.ts + UsersSetPreferenceParamsPOST.ts — preference validation and REST schema.
  • en.i18n.jsonTeams_and_channels, Group_Teams_and_Channels, Group_Unlisted_In_Conversations.

Notes / open questions

  • No new settings UI — the legacy sidebar no longer renders a user-facing preferences section (sidebarGroupByType itself has no checkbox). Both preferences are configurable via the admin default and the API. A UI control can be a follow-up.
  • New nav implementation is out of scope for this PR.

Tests

useRoomList.spec.tsx: 5 new cases (merge on/off, merge with legacy order, unlisted dropped by default, unlisted routed to Conversations). 20/20 passing.

Summary by CodeRabbit

  • New Features
    • New sidebar preference to merge Teams and Channels into a single "Teams and channels" group.
    • New sidebar preference to route rooms from unlisted/hidden groups into "Conversations" so they remain visible.
    • Defaults and labels updated so the merged group appears for users with older saved sidebar orders.

Add a `sidebarGroupTeamsAndChannels` user preference. When grouping by
type is enabled and this preference is on, the Teams and Channels sidebar
groups are merged into a single "Teams and channels" category.

- merge the team and channel buckets in useRoomList when the pref is set
- register the new group key in the default sidebar sections order
- inject the merged key for users whose saved order predates it, so the
  group still renders without a migration
- add the preference to the default-preferences setting, the
  saveUserPreferences validation and the users.setPreferences REST schema
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Jun 1, 2026

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

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 1, 2026

🦋 Changeset detected

Latest commit: 48385cf

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

This PR includes changesets to release 3 packages
Name Type
@rocket.chat/meteor Minor
@rocket.chat/rest-typings Minor
@rocket.chat/core-typings Minor

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: df8cd79a-5c5d-4e19-9e65-94be1028e985

📥 Commits

Reviewing files that changed from the base of the PR and between c1eabc4 and 48385cf.

📒 Files selected for processing (1)
  • apps/meteor/tests/end-to-end/api/miscellaneous.ts
📜 Recent review details
⏰ 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). (2)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
🧰 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/tests/end-to-end/api/miscellaneous.ts
🧠 Learnings (13)
📚 Learning: 2026-03-02T16:31:41.304Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 39250
File: apps/meteor/tests/end-to-end/api/livechat/07-queue.ts:1084-1094
Timestamp: 2026-03-02T16:31:41.304Z
Learning: In E2E API tests at apps/meteor/tests/end-to-end/api/livechat/, using sleep(1000) after updateSetting() or updateEESetting() calls in test setup hooks is acceptable and intentional to allow omnichannel settings to propagate their side effects.

Applied to files:

  • apps/meteor/tests/end-to-end/api/miscellaneous.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/end-to-end/api/miscellaneous.ts
📚 Learning: 2026-03-16T11:57:17.987Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 39657
File: apps/meteor/tests/end-to-end/apps/app-resolve-visitor.ts:43-45
Timestamp: 2026-03-16T11:57:17.987Z
Learning: In `apps/meteor/tests/end-to-end/apps/app-resolve-visitor.ts`, `externalIds` lookups are namespaced per `app.id`. Because `cleanupApps()` is called before each test run and a fresh app is installed (giving a new unique `app.id`), fixed `userId` strings like `'nonexistent-id'` in null-path tests are safe and cannot collide with stale visitor records from previous runs. Do not flag these as needing unique/random values.

Applied to files:

  • apps/meteor/tests/end-to-end/api/miscellaneous.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/end-to-end/api/miscellaneous.ts
📚 Learning: 2026-03-15T14:31:28.969Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39647
File: apps/meteor/app/api/server/v1/users.ts:710-757
Timestamp: 2026-03-15T14:31:28.969Z
Learning: In RocketChat/Rocket.Chat, the `UserCreateParamsPOST` type in `apps/meteor/app/api/server/v1/users.ts` (migrated from `packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts`) intentionally has `fields: string` (non-optional) and `settings?: IUserSettings` without a corresponding AJV schema entry. This is a pre-existing divergence carried over verbatim from the original rest-typings source (PR `#39647`). Do not flag this type/schema misalignment during the OpenAPI migration review — it is tracked as a separate follow-up fix.

Applied to files:

  • apps/meteor/tests/end-to-end/api/miscellaneous.ts
📚 Learning: 2026-02-24T19:36:55.089Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').

Applied to files:

  • apps/meteor/tests/end-to-end/api/miscellaneous.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/end-to-end/api/miscellaneous.ts
📚 Learning: 2026-03-20T13:51:23.302Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 39553
File: apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts:179-181
Timestamp: 2026-03-20T13:51:23.302Z
Learning: In `apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts`, the truthiness guards `...(integration.avatar && { avatar })`, `...(integration.emoji && { emoji })`, `...(integration.alias && { alias })`, and `...(integration.script && { script })` in the `$set` payload of `updateIncomingIntegration` are intentional. Empty-string values for these fields should NOT overwrite the stored value — only truthy values are persisted. Do not flag these as bugs preventing explicit clears.

Applied to files:

  • apps/meteor/tests/end-to-end/api/miscellaneous.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/end-to-end/api/miscellaneous.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/end-to-end/api/miscellaneous.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 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/tests/end-to-end/api/miscellaneous.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/tests/end-to-end/api/miscellaneous.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/tests/end-to-end/api/miscellaneous.ts
🔇 Additional comments (1)
apps/meteor/tests/end-to-end/api/miscellaneous.ts (1)

191-192: LGTM!


Walkthrough

This PR adds two user preferences to merge Teams and Channels into a single "Teams_and_channels" sidebar section and to route rooms from unlisted routable groups into "Conversations"; changes touch the grouping hook, preference types, server defaults/persistence, i18n, and tests.

Changes

Sidebar Teams and Channels Grouping

Layer / File(s) Summary
Core hook implementation and section configuration
apps/meteor/client/sidebar/hooks/useRoomList.ts
useRoomList hook updates sidebar section configuration to include Teams_and_channels, reads new preferences for merge and routing behavior, and refactors room-to-group mapping logic to optionally merge Teams and Channels into a single section and reroute unlisted routable groups to Conversations based on enabled flags.
Preference type definitions
apps/meteor/client/views/account/preferences/useAccountPreferencesValues.ts, apps/meteor/server/methods/saveUserPreferences.ts, packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
Preference types are extended across the full stack to include sidebarGroupTeamsAndChannels and sidebarGroupUnlistedInConversations as optional boolean fields in AccountPreferencesData, UserPreferences, and REST API contracts.
Server-side preference persistence and defaults
apps/meteor/server/methods/saveUserPreferences.ts, apps/meteor/server/settings/accounts.ts
saveUserPreferences validation schema is updated to accept the new preferences, new account default settings are registered with i18n labels, and the default sidebar section order is extended to include Teams_and_channels.
Internationalization strings
packages/i18n/src/locales/en.i18n.json
Three new English translation keys are added for the preference labels and merged group display name.
Test suite and validation
apps/meteor/client/sidebar/hooks/useRoomList.spec.tsx
Test wrapper is updated to apply new preferences and optionally persist sidebar order. New test cases validate merging behavior when enabled, separate groups when disabled, backward compatibility with legacy orders, handling of missing sections, and routing of unlisted groups to Conversations.
Changelog entry
.changeset/sidebar-teams-channels-merge.md
Changesets entry documents minor package version bumps and describes the two sidebar grouping behavior changes.

Sequence Diagram(s)

No sequence diagrams are needed for this change.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

type: feature

Suggested reviewers

  • tassoevan
🚥 Pre-merge checks | ✅ 5
✅ 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 directly describes the main feature addition: merging Teams and Channels into a single sidebar category, which is the primary objective of this pull request.
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.


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
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.77%. Comparing base (82aad55) to head (48385cf).
⚠️ Report is 14 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40750      +/-   ##
===========================================
+ Coverage    69.65%   69.77%   +0.11%     
===========================================
  Files         3339     3330       -9     
  Lines       123309   123209     -100     
  Branches     22011    21982      -29     
===========================================
+ Hits         85897    85966      +69     
+ Misses       34056    33887     -169     
  Partials      3356     3356              
Flag Coverage Δ
e2e 59.34% <30.76%> (+0.12%) ⬆️
e2e-api 46.22% <100.00%> (+0.25%) ⬆️
unit 70.49% <96.15%> (+<0.01%) ⬆️

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.

Add a `sidebarGroupUnlistedInConversations` user preference. When grouping
by type is enabled and this preference is on, rooms belonging to a routable
group (Teams, Channels, Discussions, Direct messages, Teams and channels)
that is not part of the visible sidebar sections are routed into the
"Conversations" group instead of disappearing from the sidebar.

- collect rooms from routable groups missing from the sections order and
  merge them into Conversations (deduplicated by room reference)
- ensure the Conversations key is present in the render order when it
  receives routed rooms
- register the preference in the default-preferences setting,
  saveUserPreferences validation and the users.setPreferences REST schema
@ggazzo ggazzo marked this pull request as ready for review June 2, 2026 15:26
@ggazzo ggazzo requested review from a team as code owners June 2, 2026 15:26
@ggazzo ggazzo added this to the POC-VOICE milestone Jun 2, 2026
@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label Jun 2, 2026
Copy link
Copy Markdown
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

🤖 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.

Inline comments:
In `@apps/meteor/client/sidebar/hooks/useRoomList.ts`:
- Around line 166-170: The code currently always reinserts 'Teams_and_channels'
into effectiveOrder when it's missing, preventing intentional hiding; modify the
condition in the useRoomList logic so you only inject 'Teams_and_channels' if
it's missing AND a legacy signal exists (e.g., the order contains 'Teams' or
'Channels'); update the if that checks
effectiveOrder.includes('Teams_and_channels') to also require
(effectiveOrder.includes('Teams') || effectiveOrder.includes('Channels')) before
splice so hiding via sidebarSectionsOrder works and the new
unlisted-to-'Conversations' path can apply.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 052238f0-fae0-480f-81ed-2407fadcb807

📥 Commits

Reviewing files that changed from the base of the PR and between 0ef1002 and c1eabc4.

📒 Files selected for processing (8)
  • .changeset/sidebar-teams-channels-merge.md
  • apps/meteor/client/sidebar/hooks/useRoomList.spec.tsx
  • apps/meteor/client/sidebar/hooks/useRoomList.ts
  • apps/meteor/client/views/account/preferences/useAccountPreferencesValues.ts
  • apps/meteor/server/methods/saveUserPreferences.ts
  • apps/meteor/server/settings/accounts.ts
  • packages/i18n/src/locales/en.i18n.json
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
📜 Review details
⏰ 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). (2)
  • GitHub Check: Hacktron Security Check
  • GitHub Check: cubic · AI code reviewer
🧰 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/views/account/preferences/useAccountPreferencesValues.ts
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
  • apps/meteor/server/methods/saveUserPreferences.ts
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/client/sidebar/hooks/useRoomList.ts
  • apps/meteor/client/sidebar/hooks/useRoomList.spec.tsx
🧠 Learnings (10)
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/views/account/preferences/useAccountPreferencesValues.ts
  • apps/meteor/client/sidebar/hooks/useRoomList.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.

Applied to files:

  • apps/meteor/client/views/account/preferences/useAccountPreferencesValues.ts
  • apps/meteor/client/sidebar/hooks/useRoomList.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 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/client/views/account/preferences/useAccountPreferencesValues.ts
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
  • apps/meteor/server/methods/saveUserPreferences.ts
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/client/sidebar/hooks/useRoomList.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/client/views/account/preferences/useAccountPreferencesValues.ts
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
  • apps/meteor/server/methods/saveUserPreferences.ts
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/client/sidebar/hooks/useRoomList.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/client/views/account/preferences/useAccountPreferencesValues.ts
  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
  • apps/meteor/server/methods/saveUserPreferences.ts
  • apps/meteor/server/settings/accounts.ts
  • apps/meteor/client/sidebar/hooks/useRoomList.ts
  • apps/meteor/client/sidebar/hooks/useRoomList.spec.tsx
📚 Learning: 2026-05-11T23:14:59.316Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 40469
File: packages/rest-typings/src/v1/users.ts:337-337
Timestamp: 2026-05-11T23:14:59.316Z
Learning: In Rocket.Chat REST endpoint typings (e.g., packages/rest-typings/src/v1/users.ts and other rest-typings files), keep the established convention of deriving field types from the domain model (e.g., use IUser indexed access like IUser['statusExpiresAt']) rather than swapping individual fields to serialized primitives (like string) in an ad-hoc way. If a truly different “serialized” representation is needed, perform the refactor consistently across the codebase (not just a single endpoint/field) and ensure all related REST typings stay aligned with the shared serialization types.

Applied to files:

  • packages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.ts
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.

Applied to files:

  • .changeset/sidebar-teams-channels-merge.md
📚 Learning: 2026-03-09T18:39:14.020Z
Learnt from: Harxhit
Repo: RocketChat/Rocket.Chat PR: 39476
File: apps/meteor/server/methods/addAllUserToRoom.ts:0-0
Timestamp: 2026-03-09T18:39:14.020Z
Learning: When implementing batch processing in server methods, favor a single data pass to collect both the items and any derived fields needed for validation. Use the same dataset for both validation and processing to avoid races between validation and execution, and document the approach in code comments. Apply this pattern to similar Meteor Rocket.Chat server methods under apps/meteor/server/methods to prevent race conditions and ensure consistent batch behavior.

Applied to files:

  • apps/meteor/server/methods/saveUserPreferences.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/client/sidebar/hooks/useRoomList.spec.tsx
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • apps/meteor/client/sidebar/hooks/useRoomList.spec.tsx
🔇 Additional comments (8)
.changeset/sidebar-teams-channels-merge.md (1)

1-10: LGTM!

packages/i18n/src/locales/en.i18n.json (1)

2515-2516: LGTM!

Also applies to: 5233-5233

apps/meteor/client/sidebar/hooks/useRoomList.spec.tsx (6)

67-68: LGTM!

Also applies to: 72-72, 76-78, 81-83, 84-110


179-196: LGTM!


198-210: LGTM!


212-225: LGTM!


227-241: LGTM!


243-263: LGTM!

Comment on lines +166 to +170
const effectiveOrder: string[] = [...sidebarOrder];
if (!effectiveOrder.includes('Teams_and_channels')) {
const channelsIndex = effectiveOrder.indexOf('Channels');
effectiveOrder.splice(channelsIndex === -1 ? effectiveOrder.length : channelsIndex + 1, 0, 'Teams_and_channels');
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Only inject Teams_and_channels for legacy orders, not for intentionally hidden ones.

This reinserts the merged section whenever the key is absent, which makes it impossible to hide that group via sidebarSectionsOrder and prevents the new unlisted-to-Conversations path from ever applying to Teams_and_channels. Gate the injection on a legacy signal like an existing Teams or Channels entry.

Proposed fix
 			const effectiveOrder: string[] = [...sidebarOrder];
-			if (!effectiveOrder.includes('Teams_and_channels')) {
+			const shouldInjectMergedGroup =
+				mergeTeamsAndChannels &&
+				!effectiveOrder.includes('Teams_and_channels') &&
+				(effectiveOrder.includes('Teams') || effectiveOrder.includes('Channels'));
+
+			if (shouldInjectMergedGroup) {
 				const channelsIndex = effectiveOrder.indexOf('Channels');
 				effectiveOrder.splice(channelsIndex === -1 ? effectiveOrder.length : channelsIndex + 1, 0, 'Teams_and_channels');
 			}
🤖 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/client/sidebar/hooks/useRoomList.ts` around lines 166 - 170, The
code currently always reinserts 'Teams_and_channels' into effectiveOrder when
it's missing, preventing intentional hiding; modify the condition in the
useRoomList logic so you only inject 'Teams_and_channels' if it's missing AND a
legacy signal exists (e.g., the order contains 'Teams' or 'Channels'); update
the if that checks effectiveOrder.includes('Teams_and_channels') to also require
(effectiveOrder.includes('Teams') || effectiveOrder.includes('Channels')) before
splice so hiding via sidebarSectionsOrder works and the new
unlisted-to-'Conversations' path can apply.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/meteor/client/sidebar/hooks/useRoomList.ts">

<violation number="1" location="apps/meteor/client/sidebar/hooks/useRoomList.ts:167">
P2: Unconditionally injecting `Teams_and_channels` into `effectiveOrder` whenever it is absent makes it impossible for users to intentionally hide this group (it always gets re-added) and prevents the unlisted-to-Conversations routing from applying to merged-group rooms. Gate the injection on `mergeTeamsAndChannels` being active and on a legacy-order signal (e.g., `Teams` or `Channels` still being present in the saved order).</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

// Build the render order. Users with a `sidebarSectionsOrder` saved before the
// 'Teams_and_channels' group existed won't have the key, so inject it after 'Channels'.
const effectiveOrder: string[] = [...sidebarOrder];
if (!effectiveOrder.includes('Teams_and_channels')) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Unconditionally injecting Teams_and_channels into effectiveOrder whenever it is absent makes it impossible for users to intentionally hide this group (it always gets re-added) and prevents the unlisted-to-Conversations routing from applying to merged-group rooms. Gate the injection on mergeTeamsAndChannels being active and on a legacy-order signal (e.g., Teams or Channels still being present in the saved order).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/client/sidebar/hooks/useRoomList.ts, line 167:

<comment>Unconditionally injecting `Teams_and_channels` into `effectiveOrder` whenever it is absent makes it impossible for users to intentionally hide this group (it always gets re-added) and prevents the unlisted-to-Conversations routing from applying to merged-group rooms. Gate the injection on `mergeTeamsAndChannels` being active and on a legacy-order signal (e.g., `Teams` or `Channels` still being present in the saved order).</comment>

<file context>
@@ -134,17 +142,56 @@ export const useRoomList = ({ collapsedGroups }: { collapsedGroups?: string[] })
+			// Build the render order. Users with a `sidebarSectionsOrder` saved before the
+			// 'Teams_and_channels' group existed won't have the key, so inject it after 'Channels'.
+			const effectiveOrder: string[] = [...sidebarOrder];
+			if (!effectiveOrder.includes('Teams_and_channels')) {
+				const channelsIndex = effectiveOrder.indexOf('Channels');
+				effectiveOrder.splice(channelsIndex === -1 ? effectiveOrder.length : channelsIndex + 1, 0, 'Teams_and_channels');
</file context>
Suggested change
if (!effectiveOrder.includes('Teams_and_channels')) {
const shouldInjectMergedGroup =
mergeTeamsAndChannels &&
!effectiveOrder.includes('Teams_and_channels') &&
(effectiveOrder.includes('Teams') || effectiveOrder.includes('Channels'));
if (shouldInjectMergedGroup) {

Adds sidebarGroupTeamsAndChannels and sidebarGroupUnlistedInConversations to the expected user preferences keys, fixing the Test API failure caused by the two new default user preferences.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-to-poc type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant