feat(sidebar): add Teams and channels merged category#40750
Conversation
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
|
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: 48385cf 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 Run ID: 📒 Files selected for processing (1)
📜 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)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (13)📚 Learning: 2026-03-02T16:31:41.304ZApplied to files:
📚 Learning: 2025-11-24T17:08:17.065ZApplied to files:
📚 Learning: 2026-03-16T11:57:17.987ZApplied to files:
📚 Learning: 2025-11-24T17:08:17.065ZApplied to files:
📚 Learning: 2026-03-15T14:31:28.969ZApplied to files:
📚 Learning: 2026-02-24T19:36:55.089ZApplied to files:
📚 Learning: 2025-11-24T17:08:17.065ZApplied to files:
📚 Learning: 2026-03-20T13:51:23.302ZApplied to files:
📚 Learning: 2025-11-24T17:08:17.065ZApplied to files:
📚 Learning: 2025-11-24T17:08:17.065ZApplied to files:
📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
📚 Learning: 2026-05-06T12:21:44.083ZApplied to files:
🔇 Additional comments (1)
WalkthroughThis 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. ChangesSidebar Teams and Channels Grouping
Sequence Diagram(s)No sequence diagrams are needed for this change. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ 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. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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
There was a problem hiding this comment.
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
📒 Files selected for processing (8)
.changeset/sidebar-teams-channels-merge.mdapps/meteor/client/sidebar/hooks/useRoomList.spec.tsxapps/meteor/client/sidebar/hooks/useRoomList.tsapps/meteor/client/views/account/preferences/useAccountPreferencesValues.tsapps/meteor/server/methods/saveUserPreferences.tsapps/meteor/server/settings/accounts.tspackages/i18n/src/locales/en.i18n.jsonpackages/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.tspackages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.tsapps/meteor/server/methods/saveUserPreferences.tsapps/meteor/server/settings/accounts.tsapps/meteor/client/sidebar/hooks/useRoomList.tsapps/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.tsapps/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.tsapps/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.tspackages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.tsapps/meteor/server/methods/saveUserPreferences.tsapps/meteor/server/settings/accounts.tsapps/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.tspackages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.tsapps/meteor/server/methods/saveUserPreferences.tsapps/meteor/server/settings/accounts.tsapps/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.tspackages/rest-typings/src/v1/users/UsersSetPreferenceParamsPOST.tsapps/meteor/server/methods/saveUserPreferences.tsapps/meteor/server/settings/accounts.tsapps/meteor/client/sidebar/hooks/useRoomList.tsapps/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!
| 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'); | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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')) { |
There was a problem hiding this comment.
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>
| 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.
Proposed changes
Adds two opt-in sidebar grouping user preferences to the legacy sidebar (
useRoomList, featuresecondarySidebarOFF). The new navigation (RoomsNavigationProvider) is intentionally untouched — different grouping model, handled separately.1.
sidebarGroupTeamsAndChannels— merged categoryWhen Group by type is enabled and this preference is on, the Teams and Channels groups merge into a single "Teams and channels" category.
sidebarGroupByTypeis enabled.Teams/Channelsgroups are not rendered while merged.Teams_and_channelskey is injected for users whose savedsidebarSectionsOrderpredates it, so the group renders without a migration.2.
sidebarGroupUnlistedInConversations— catch-all for hidden groupsToday, 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.
sidebarGroupByTypeis enabled.Conversationsis 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_channelsin the default sections order.saveUserPreferences.ts+UsersSetPreferenceParamsPOST.ts— preference validation and REST schema.en.i18n.json—Teams_and_channels,Group_Teams_and_Channels,Group_Unlisted_In_Conversations.Notes / open questions
sidebarGroupByTypeitself has no checkbox). Both preferences are configurable via the admin default and the API. A UI control can be a follow-up.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