Skip to content

refactor: Sidebar badges#37638

Merged
kodiakhq[bot] merged 20 commits intodevelopfrom
refactor/sidebar-badges
Dec 12, 2025
Merged

refactor: Sidebar badges#37638
kodiakhq[bot] merged 20 commits intodevelopfrom
refactor/sidebar-badges

Conversation

@aleksandernsilva
Copy link
Contributor

@aleksandernsilva aleksandernsilva commented Nov 28, 2025

Proposed changes (including videos or screenshots)

This pull request refactors the sidebar badges extracting the logic that currently is inline and hard to test and moving them to a new SidebarItemBadges component .

This is an effort to allow better testing for this specific part of the UI and prepare the code for the new invitation badge to be introduced by #37635.

  • Introduced a new SidebarItemBadges component to encapsulate logic for displaying unread and omnichannel badges.
  • Updated revevant components in sidebar V1, V2, navigation and sidepanel to use SidebarItemBadges for badge rendering.
  • Added a new useUnreadDisplay hook to centralize unread message and mention calculation (same thing we already do for the other sidebars) and updated sidebar V1 to use it.
  • Extracted unread badge display into a dedicated UnreadBadge component for consistency.
  • Changed OmnichannelBadges to be a default export and updated imports following guidelines
  • Added tests for SidebarItemBadges.

Issue(s)

FB-64

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Refactor

    • Unified badge rendering across sidebars, nav and side panels for consistent visuals and behavior.
    • Centralized unread/mention logic into a shared hook, simplifying highlight, counts and accessible text.
    • Exposed unread data type for reuse across the UI.
  • Tests

    • Added unit tests for badge behavior and the unread hook.
    • Added stories plus snapshot and accessibility tests for omnichannel badge scenarios.

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

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Nov 28, 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 Nov 28, 2025

⚠️ No Changeset found

Latest commit: 5d30f18

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

This PR includes no changesets

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

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

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Walkthrough

Consolidates unread and omnichannel badge rendering into new reusable components and a hook: adds UnreadBadge, SidebarItemBadges/RoomSidePanelItemBadges, useUnreadDisplay (typed with exported UnreadData), updates many sidebar/nav components to use these primitives, and adjusts OmnichannelBadges exports/imports and several type signatures to SubscriptionWithRoom.

Changes

Cohort / File(s) Summary
New unread badge primitives
apps/meteor/client/sidebar/badges/UnreadBadge.tsx, apps/meteor/client/sidebarv2/badges/UnreadBadge.tsx
Added default-exported UnreadBadge components rendering accessible unread count badges with variant, total and localized aria-label.
Composite badge components
apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx, apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx, apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx, apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.tsx
Added default-exported composite badge components that call useUnreadDisplay and conditionally render UnreadBadge and OmnichannelBadges.
Hook for unread display
apps/meteor/client/sidebar/hooks/useUnreadDisplay.tsx, apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts, apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts
Added/updated useUnreadDisplay implementations delegating to getSubscriptionUnreadData and accepting the exported UnreadData shape.
Unread logic type export
apps/meteor/lib/getSubscriptionUnreadData.ts
Exported UnreadData type (previously private) used by hooks/components for typed input.
Sidebar / nav components updated
apps/meteor/client/NavBarV2/NavBarSearch/NavBarSearchItemWithData.tsx, apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx, apps/meteor/client/sidebarv2/RoomList/SidebarItemTemplateWithData.tsx, apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx, apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsx
Replaced inline unread/omnichannel badge JSX with new composite badge components and adapted unread props to use useUnreadDisplay outputs.
OmnichannelBadges export/import changes
apps/meteor/client/sidebar/badges/OmnichannelBadges.tsx, apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx (deleted), apps/meteor/client/views/omnichannel/components/OmnichannelBadges/*
Converted some OmnichannelBadges to default export with index re-export, removed a duplicate sidebarv2 copy, and adjusted import paths.
Type migrations to SubscriptionWithRoom
apps/meteor/client/sidebar/RoomList/RoomList.tsx, apps/meteor/client/sidebar/RoomList/RoomListRow.tsx, apps/meteor/client/sidebar/hooks/useAvatarTemplate.tsx, apps/meteor/client/sidebar/hooks/useRoomList.ts, apps/meteor/client/sidebar/search/Row.tsx, apps/meteor/client/sidebar/search/SearchList.tsx
Migrated many props/signatures and internal types from IRoom/ISubscription to SubscriptionWithRoom and added a helper type guard where needed.
Tests & stories added
apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx, apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx, apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx, apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx, apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx, apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx, apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.stories.tsx
Added unit tests for SidebarItemBadges and useUnreadDisplay; added OmnichannelBadges stories and snapshot/a11y tests.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Potential focus areas:

  • Consistency of useUnreadDisplay typings and all call sites.
  • Import/export updates for OmnichannelBadges (ensure no broken imports).
  • Accessibility strings / i18n keys used by UnreadBadge and composite badges.
  • Tests and mocks updated to reflect default-export changes.

Possibly related PRs

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • tassoevan

Poem

🐰 I hopped through code with joyful cheer,

Badges gathered, tidy and clear,
Counts that sparkle, omnichannel bright,
Small components stitched just right,
A happy rabbit celebrates tonight.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 2 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Linked Issues check ❓ Inconclusive The linked issue FB-64 addresses implementing a sidebar invited status badge. The PR introduces SidebarItemBadges component and prepares architecture for additional badges, but does not implement the invited status badge itself. Verify whether the PR is intended as a preparatory refactor for FB-64 or if invited status badge implementation is out of scope for this PR.
Out of Scope Changes check ❓ Inconclusive Changes are primarily focused on badge refactoring across sidebar components, but include broader type system updates (SubscriptionWithRoom usage) that extend beyond badge logic. Clarify whether type system changes to use SubscriptionWithRoom are necessary for badge refactoring or represent scope creep.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor: Sidebar badges' accurately and concisely summarizes the main change, which is refactoring badge rendering logic across sidebar components.
✨ 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 refactor/sidebar-badges

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 Nov 28, 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 +33B
queue-worker-service 132MiB 132MiB -662B
ddp-streamer-service 126MiB 126MiB +132B
account-service 113MiB 113MiB -150B
stream-hub-service 111MiB 111MiB -111B
presence-service 111MiB 111MiB +1.3KiB
authorization-service 111MiB 111MiB +104B

📊 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 12:47 (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]
  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]
  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]
  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]
  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]
  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]
  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.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]
Loading

Statistics (last 18 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-37638
  • Baseline: develop
  • Timestamp: 2025-12-12 12:47:12 UTC
  • Historical data points: 18

Updated: Fri, 12 Dec 2025 12:47:13 GMT

@aleksandernsilva
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

🧹 Nitpick comments (3)
apps/meteor/client/sidebar/badges/UnreadBadge.tsx (1)

17-17: Avoid as any type assertion for style prop.

The as any type assertion bypasses TypeScript's type safety. The Badge component from Fuselage should accept valid style props without this cast.

Consider one of these approaches:

  1. If Badge doesn't accept style directly, use a wrapper with proper styling:
-		<Badge
-			role='status'
-			{...({ style: { display: 'inline-flex', flexShrink: 0 } } as any)}
-			variant={variant}
+		<Box display='inline-flex' flexShrink={0}>
+			<Badge
+				role='status'
+				variant={variant}
  1. Or verify that Badge accepts these style properties and remove the cast if it does.
apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx (1)

108-108: Remove unnecessary async from test functions.

The test functions are marked as async but do not use await anywhere. This adds unnecessary complexity.

Apply this pattern to all test functions:

-it('should return correct unread data for [Direct message unread]', async () => {
+it('should return correct unread data for [Direct message unread]', () => {
apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (1)

98-100: Consider using highlightUnread from useUnreadDisplay.

The highlighted variable is computed manually from hideUnreadStatus, alert, and unread (line 100), but useUnreadDisplay likely returns a highlightUnread property that encapsulates this same logic (as seen in the test file at line 139, 203, etc.).

Apply this diff to use the hook's output:

-	const { unreadCount, unreadTitle, showUnread } = useUnreadDisplay(room);
+	const { unreadCount, unreadTitle, showUnread, highlightUnread } = useUnreadDisplay(room);

-	const highlighted = Boolean(!hideUnreadStatus && (alert || unread));
+	const highlighted = highlightUnread;

This eliminates duplicate logic and ensures consistency with other components using the same hook.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0064a4f and 8dd1702.

📒 Files selected for processing (23)
  • apps/meteor/client/NavBarV2/NavBarSearch/NavBarSearchItemWithData.tsx (3 hunks)
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (4 hunks)
  • apps/meteor/client/sidebar/badges/OmnichannelBadges.tsx (2 hunks)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/sidebar/badges/UnreadBadge.tsx (1 hunks)
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx (1 hunks)
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/RoomList/SidebarItemTemplateWithData.tsx (4 hunks)
  • apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx (2 hunks)
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/badges/UnreadBadge.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts (1 hunks)
  • apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx (4 hunks)
  • apps/meteor/client/views/navigation/sidebar/badges/OmnichannelBadges.tsx (0 hunks)
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts (1 hunks)
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsx (3 hunks)
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.tsx (1 hunks)
  • apps/meteor/lib/getSubscriptionUnreadData.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/meteor/client/views/navigation/sidebar/badges/OmnichannelBadges.tsx
🧰 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/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebarv2/badges/UnreadBadge.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.tsx
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/UnreadBadge.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts
  • apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx
  • apps/meteor/lib/getSubscriptionUnreadData.ts
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/NavBarV2/NavBarSearch/NavBarSearchItemWithData.tsx
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx
  • apps/meteor/client/sidebar/badges/OmnichannelBadges.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsx
  • apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx
  • apps/meteor/client/sidebarv2/RoomList/SidebarItemTemplateWithData.tsx
🧠 Learnings (15)
📓 Common learnings
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37408
File: apps/meteor/client/views/admin/ABAC/useRoomAttributeOptions.tsx:53-69
Timestamp: 2025-11-10T19:06:20.146Z
Learning: In the Rocket.Chat repository, do not provide suggestions or recommendations about code sections marked with TODO comments. The maintainers have already identified these as future work and external reviewers lack the full context about implementation plans and timing.
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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 **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts
  • apps/meteor/lib/getSubscriptionUnreadData.ts
  • apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts
📚 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/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsx
📚 Learning: 2025-11-27T17:56:26.027Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.027Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.

Applied to files:

  • apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx
  • apps/meteor/client/NavBarV2/NavBarSearch/NavBarSearchItemWithData.tsx
🧬 Code graph analysis (12)
apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1)
packages/core-typings/src/IRoom.ts (2)
  • IRoom (21-95)
  • isOmnichannelRoom (361-361)
apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx (1)
packages/core-typings/src/IRoom.ts (1)
  • isOmnichannelRoom (361-361)
apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.tsx (1)
packages/core-typings/src/IRoom.ts (1)
  • isOmnichannelRoom (361-361)
apps/meteor/client/sidebar/hooks/useUnreadDisplay.tsx (1)
apps/meteor/lib/getSubscriptionUnreadData.ts (2)
  • UnreadData (36-39)
  • getSubscriptionUnreadData (41-64)
apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx (2)
packages/mock-providers/src/index.ts (1)
  • mockAppRoot (3-3)
apps/meteor/tests/mocks/data.ts (1)
  • createFakeSubscription (63-90)
apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx (3)
apps/meteor/tests/mocks/data.ts (1)
  • createFakeSubscription (63-90)
packages/mock-providers/src/index.ts (1)
  • mockAppRoot (3-3)
apps/meteor/client/sidebar/hooks/useUnreadDisplay.tsx (1)
  • useUnreadDisplay (6-10)
apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts (2)
apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts (1)
  • useUnreadDisplay (6-10)
apps/meteor/lib/getSubscriptionUnreadData.ts (1)
  • UnreadData (36-39)
apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx (1)
apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts (1)
  • useUnreadDisplay (6-10)
apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts (2)
apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts (1)
  • useUnreadDisplay (6-10)
apps/meteor/lib/getSubscriptionUnreadData.ts (1)
  • UnreadData (36-39)
apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx (3)
packages/mock-providers/src/index.ts (1)
  • mockAppRoot (3-3)
apps/meteor/client/lib/appLayout.tsx (1)
  • render (26-28)
apps/meteor/tests/mocks/data.ts (1)
  • createFakeSubscription (63-90)
apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx (1)
packages/core-typings/src/IRoom.ts (1)
  • IRoom (21-95)
apps/meteor/client/sidebarv2/RoomList/SidebarItemTemplateWithData.tsx (1)
apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts (1)
  • useUnreadDisplay (6-10)
⏰ 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: 📦 Build Packages
  • GitHub Check: CodeQL-Build
🔇 Additional comments (15)
apps/meteor/client/sidebar/hooks/useUnreadDisplay.tsx (1)

6-10: LGTM!

The hook provides a clean abstraction for obtaining unread display data with i18n support.

apps/meteor/client/sidebarv2/RoomList/SidebarItemTemplateWithData.tsx (1)

16-16: LGTM! Clean refactoring to centralize badge rendering.

The inline badge logic has been successfully replaced with the dedicated SidebarItemBadges component, improving code organization and reusability.

Also applies to: 96-96, 142-142

apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx (1)

13-13: LGTM! Consistent refactoring pattern.

The changes successfully centralize badge rendering and optimize the destructuring to only extract needed fields from useUnreadDisplay.

Also applies to: 35-35, 76-76

apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsx (1)

9-9: LGTM! Sidepanel badge rendering properly refactored.

The changes align with the broader refactoring effort, replacing inline badge logic with the dedicated RoomSidePanelItemBadges component.

Also applies to: 69-69

apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx (1)

1-24: LGTM!

Test setup properly mocks dependencies and configures translations for badge rendering verification.

apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx (1)

13-23: Verify intentional layout difference from non-v2 SidebarItemBadges.

This implementation differs from apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx, which wraps the badges in <Margins inlineStart={8}>. Ensure this difference is intentional and that both sidebar variants achieve the desired spacing.

apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1)

1-30: LGTM!

Test setup and helper function are appropriate for unit testing badge rendering behavior.

apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1)

9-12: Verify type consistency with sidebarv2 implementation.

The sidebarv2 version (apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx) uses SubscriptionWithRoom while this version uses ISubscription & IRoom. Ensure both type definitions are compatible and that the difference is intentional.

apps/meteor/client/NavBarV2/NavBarSearch/NavBarSearchItemWithData.tsx (1)

9-9: LGTM!

The refactor successfully consolidates badge rendering logic into the shared SidebarItemBadges component, improving maintainability.

Also applies to: 24-24, 36-36

apps/meteor/client/sidebar/badges/OmnichannelBadges.tsx (1)

8-8: LGTM!

Converting to a default export aligns with the consumption pattern in SidebarItemBadges and maintains the same component behavior.

Also applies to: 23-23

apps/meteor/lib/getSubscriptionUnreadData.ts (1)

36-39: LGTM!

Exporting the UnreadData type promotes consistency and reusability across hooks and components that handle unread display logic.

apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts (1)

3-3: LGTM!

Using the exported UnreadData type improves type consistency and eliminates duplication across the codebase.

Also applies to: 6-6

apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts (1)

1-10: LGTM: Clean type refactoring.

The change from an inline Pick type to the dedicated UnreadData type improves maintainability and consistency across the codebase. The implementation correctly delegates to getSubscriptionUnreadData, maintaining the existing behavior while improving the type safety.

apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx (1)

8-23: I encountered a technical issue accessing the repository directly. Since I cannot clone and search the codebase through shell scripts, I'm unable to definitively verify whether all imports of OmnichannelBadges have been updated from named imports to default imports.


Unable to verify: all imports updated to default export.

The original review comment correctly identifies a breaking change from named export to default export. However, without access to the codebase, I cannot confirm whether all 47 consumers (or however many exist) have been updated. This verification requires searching the entire codebase for remaining named import patterns like import { OmnichannelBadges } and confirming all are now using import OmnichannelBadges from.

This requires manual verification or retry with codebase access.

apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.tsx (1)

1-25: No organizational consolidation needed—sidebarv2 is an intentional architectural separation supporting incremental migration.

The review comment's concern about duplication is based on a misunderstanding of Rocket.Chat's architecture. The web search reveals that sidebarv2 exists as a deliberate architectural pattern for incremental migration from the legacy sidebar (v1) to a new implementation. Both versions coexist temporarily through portal/compatibility layers, allowing teams to migrate without breaking backward compatibility. This is a known and intentional design decision, not a consolidation issue.

The file correctly imports from sidebarv2 as part of the forward migration strategy. No action is required.

Likely an incorrect or invalid review comment.

@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.71%. Comparing base (17f587b) to head (5d30f18).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #37638   +/-   ##
========================================
  Coverage    67.71%   67.71%           
========================================
  Files         3452     3458    +6     
  Lines       113979   113955   -24     
  Branches     20943    20927   -16     
========================================
- Hits         77182    77167   -15     
- Misses       34663    34664    +1     
+ Partials      2134     2124   -10     
Flag Coverage Δ
e2e 57.32% <95.74%> (-0.01%) ⬇️
e2e-api 42.31% <ø> (+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.

@aleksandernsilva aleksandernsilva marked this pull request as ready for review December 1, 2025 13:28
@aleksandernsilva aleksandernsilva requested a review from a team as a code owner December 1, 2025 13:28
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx (2)

26-26: Fix typo in test description.

"shound" should be "should".

Apply this diff:

-	it('should render UnreadBadge when there are unread messages', () => {
+	it('should render UnreadBadge when there are unread messages', () => {

34-34: Fix typo in test description.

"shound" should be "should".

Apply this diff:

-	it('should not render UnreadBadge when there are no unread messages', () => {
+	it('should not render UnreadBadge when there are no unread messages', () => {
🧹 Nitpick comments (1)
apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx (1)

39-39: Imprecise assertion could produce false positive.

The assertion checks for a specific accessible name 'Test Room' that would never match the actual badge format ('{{count}} mention(s) from {{roomTitle}}'). If the badge incorrectly renders, this test would still pass.

Apply this diff to check that no badge with role 'status' exists at all:

-		expect(screen.queryByRole('status', { name: 'Test Room' })).not.toBeInTheDocument();
+		expect(screen.queryByRole('status')).not.toBeInTheDocument();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8dd1702 and 20fd9dd.

📒 Files selected for processing (6)
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (4 hunks)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx
🧰 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/sidebarv2/badges/SidebarItemBadges.spec.tsx
🧠 Learnings (11)
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
📚 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 **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
🧬 Code graph analysis (1)
apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx (3)
packages/mock-providers/src/index.ts (1)
  • mockAppRoot (3-3)
apps/meteor/client/lib/appLayout.tsx (1)
  • render (26-28)
apps/meteor/tests/mocks/data.ts (1)
  • createFakeSubscription (63-90)

@dougfabris dougfabris added this to the 7.14.0 milestone Dec 8, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (3)
apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1)

14-24: LGTM! Clean centralization of badge rendering logic.

The component properly:

  • Uses useUnreadDisplay hook for unread state
  • Conditionally renders UnreadBadge based on showUnread
  • Conditionally renders OmnichannelBadges for omnichannel rooms
  • Applies consistent margin spacing via Margins

Note: The empty line at Line 20 was already flagged in a previous review.

apps/meteor/client/sidebarv2/badges/UnreadBadge.tsx (1)

11-24: Handle optional roomTitle in translation.

The roomTitle prop is optional but passed directly to the translation function. When undefined, this could result in "undefined" being interpolated into the aria-label string.

Apply this diff to provide a fallback:

-			aria-label={t('__unreadTitle__from__roomTitle__', { unreadTitle: title, roomTitle })}
+			aria-label={t('__unreadTitle__from__roomTitle__', { unreadTitle: title, roomTitle: roomTitle ?? '' })}
apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx (1)

44-54: Prefer semantic text-based queries over data-testid for OmnichannelBadges

Since the mock renders visible text (OmnichannelBadges), you can avoid getByTestId/queryByTestId and assert on that text instead, aligning with Testing Library’s guidance to use user-facing selectors.

-		expect(screen.getByTestId('omnichannel-badges')).toBeInTheDocument();
+		expect(screen.getByText('OmnichannelBadges')).toBeInTheDocument();
@@
-		expect(screen.queryByTestId('omnichannel-badges')).not.toBeInTheDocument();
+		expect(screen.queryByText('OmnichannelBadges')).not.toBeInTheDocument();
🧹 Nitpick comments (2)
apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts (1)

6-10: Consider consolidating duplicate hook implementations.

This hook is now identical to apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts. While the duplication may be intentional for different sidebar variants, consolidating into a shared location would improve maintainability and ensure consistency.

Example: Move to a shared location like apps/meteor/client/hooks/useUnreadDisplay.ts and import from both sidebars.

apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx (1)

35-42: Tighten the negative assertion to check for any unread status element

Instead of matching a specific accessible name, you can simplify the negative case to assert that no status element is present at all, which more directly encodes the intent “no unread badge is rendered.”

-		expect(screen.queryByRole('status', { name: 'Test Room' })).not.toBeInTheDocument();
+		expect(screen.queryByRole('status')).not.toBeInTheDocument();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 20fd9dd and a1e635d.

📒 Files selected for processing (22)
  • apps/meteor/client/NavBarV2/NavBarSearch/NavBarSearchItemWithData.tsx (3 hunks)
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (4 hunks)
  • apps/meteor/client/sidebar/badges/OmnichannelBadges.tsx (2 hunks)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/sidebar/badges/UnreadBadge.tsx (1 hunks)
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx (1 hunks)
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/RoomList/SidebarItemTemplateWithData.tsx (4 hunks)
  • apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx (2 hunks)
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/badges/UnreadBadge.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts (1 hunks)
  • apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx (4 hunks)
  • apps/meteor/client/views/navigation/sidebar/badges/OmnichannelBadges.tsx (0 hunks)
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts (1 hunks)
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsx (3 hunks)
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/meteor/client/views/navigation/sidebar/badges/OmnichannelBadges.tsx
🚧 Files skipped from review as they are similar to previous changes (11)
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.tsx
  • apps/meteor/client/sidebar/badges/UnreadBadge.tsx
  • apps/meteor/client/sidebar/hooks/useUnreadDisplay.spec.tsx
  • apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx
  • apps/meteor/client/views/navigation/sidebar/RoomList/SidebarItemWithData.tsx
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx
🧰 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/sidebarv2/RoomList/SidebarItemTemplateWithData.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx
  • apps/meteor/client/sidebarv2/badges/UnreadBadge.tsx
  • apps/meteor/client/sidebar/badges/OmnichannelBadges.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsx
  • apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts
  • apps/meteor/client/NavBarV2/NavBarSearch/NavBarSearchItemWithData.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
🧠 Learnings (14)
📚 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/RoomList/SideBarItemTemplateWithData.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsx
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: UserBridge.doGetUserRoomIds in packages/apps-engine/src/server/bridges/UserBridge.ts has a bug where it implicitly returns undefined when the app lacks read permission (missing return statement in the else case of the permission check).

Applied to files:

  • apps/meteor/client/sidebarv2/badges/UnreadBadge.tsx
📚 Learning: 2025-11-27T17:56:26.050Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.050Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.

Applied to files:

  • apps/meteor/client/sidebarv2/badges/UnreadBadge.tsx
  • apps/meteor/client/NavBarV2/NavBarSearch/NavBarSearchItemWithData.tsx
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
📚 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 **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
📚 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/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx
🧬 Code graph analysis (6)
apps/meteor/client/sidebarv2/RoomList/SidebarItemTemplateWithData.tsx (1)
apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts (1)
  • useUnreadDisplay (6-10)
apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1)
packages/core-typings/src/IRoom.ts (2)
  • IRoom (21-95)
  • isOmnichannelRoom (361-361)
apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (1)
apps/meteor/client/sidebar/hooks/useUnreadDisplay.tsx (1)
  • useUnreadDisplay (6-10)
apps/meteor/client/sidebarv2/badges/UnreadBadge.tsx (1)
packages/ui-contexts/src/index.ts (1)
  • useTranslation (80-80)
apps/meteor/client/sidebar/badges/OmnichannelBadges.tsx (1)
packages/core-typings/src/IRoom.ts (1)
  • IRoom (21-95)
apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts (2)
apps/meteor/client/views/navigation/sidebar/hooks/useUnreadDisplay.ts (1)
  • useUnreadDisplay (6-10)
apps/meteor/lib/getSubscriptionUnreadData.ts (1)
  • UnreadData (36-39)
⏰ 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 (9)
apps/meteor/client/sidebar/badges/OmnichannelBadges.tsx (1)

8-23: LGTM! Clean conversion to default export.

The change from named to default export aligns with the broader refactor pattern across the PR. Component logic remains unchanged.

apps/meteor/client/sidebarv2/RoomList/SidebarItemTemplateWithData.tsx (1)

96-96: LGTM! Clean integration of SidebarItemBadges.

The refactor properly delegates badge rendering to the centralized SidebarItemBadges component while maintaining the unread display logic via useUnreadDisplay. The hook outputs are correctly used for aria-label and menu props.

Also applies to: 142-142

apps/meteor/client/NavBarV2/NavBarSearch/NavBarSearchItemWithData.tsx (1)

24-24: LGTM! Consistent badge refactor pattern.

The changes align with the broader refactoring effort, properly using useUnreadDisplay and delegating badge rendering to SidebarItemBadges.

Also applies to: 36-36

apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1)

18-60: LGTM! Well-structured test coverage.

The test suite properly covers the key badge rendering scenarios:

  • UnreadBadge visibility based on unread state
  • OmnichannelBadges visibility based on room type

Good use of mock providers and test isolation via jest.resetAllMocks().

apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (1)

96-98: LGTM! Consistent refactor for sidebar v1.

The changes properly integrate the new badge architecture:

  • Uses useUnreadDisplay for centralized unread state
  • Delegates badge rendering to SidebarItemBadges
  • Correctly derives threadUnread from unreadCount.threads
  • Maintains proper accessibility with dynamic aria-label

Also applies to: 138-138, 144-144, 152-152

apps/meteor/client/sidebarv2/hooks/useUnreadDisplay.ts (1)

3-4: LGTM! Clean type import.

Using the exported UnreadData type improves code clarity and maintainability compared to inline type definitions.

apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsx (1)

2-2: Badge refactor wiring and unread integration look consistent

The switch to useUnreadDisplay (highlightUnread/unreadCount), passing threadUnread={unreadCount.threads > 0}, using SidebarItemIcon with highlighted, and delegating badges to RoomSidePanelItemBadges are all internally consistent and preserve the existing RoomSidePanelItem structure.

Also applies to: 9-9, 29-29, 40-56, 64-69

apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.spec.tsx (2)

1-10: Test setup and OmnichannelBadges mock are appropriate

Using mockAppRoot().withTranslations(...).build() plus a module mock for SidePanelOmnichannelBadges cleanly isolates translations and omnichannel rendering, and afterEach(jest.resetAllMocks) keeps the suite independent.

Also applies to: 12-24


26-33: Accessible-name assertion for unread badge is solid

The positive unread case correctly asserts on the status role and full accessible name ('1 mention from Test Room'), which tightly couples the test to the intended i18n output and ARIA semantics.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.stories.tsx (1)

17-17: Consider tightening the type assertion.

The double type assertion as unknown as ISubscription & IRoom completely bypasses TypeScript's type checking. While this may be necessary if createFakeSubscription doesn't return an exact match, consider:

  1. Updating createFakeSubscription to return the correct type, or
  2. Using a more specific type assertion that validates compatibility

This would catch type mismatches earlier and improve type safety in tests.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 55b16b9 and 95840d6.

⛔ Files ignored due to path filters (1)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/__snapshots__/OmnichannelBadges.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (9)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx (0 hunks)
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.tsx (1 hunks)
  • apps/meteor/client/views/navigation/sidepanel/omnichannel/SidePanelOmnichannelBadges/SidePanelOmnichannelBadges.tsx (0 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx (1 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.stories.tsx (1 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx (2 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/index.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • apps/meteor/client/views/navigation/sidepanel/omnichannel/SidePanelOmnichannelBadges/SidePanelOmnichannelBadges.tsx
  • apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx
  • apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItemBadges.tsx
🧰 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/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/index.ts
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.stories.tsx
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx
🧠 Learnings (11)
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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 **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 Learning: 2025-11-27T17:56:26.050Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.050Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.

Applied to files:

  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx
🧬 Code graph analysis (2)
apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.stories.tsx (3)
apps/meteor/tests/mocks/data.ts (1)
  • createFakeSubscription (63-90)
packages/core-typings/src/IRoom.ts (1)
  • IRoom (21-95)
packages/mock-providers/src/index.ts (1)
  • mockAppRoot (3-3)
apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx (1)
packages/core-typings/src/IRoom.ts (1)
  • IRoom (21-95)
⏰ 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 (7)
apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx (2)

4-6: LGTM: Import paths updated appropriately.

The import paths have been updated to use relative references, which is appropriate for internal module organization.


8-23: LGTM: Export conversion aligns with PR objectives.

Converting from named export to default export standardizes the component's export pattern, making it consistent with the new SidebarItemBadges architecture referenced in the PR objectives.

apps/meteor/client/views/omnichannel/components/OmnichannelBadges/index.ts (1)

1-1: LGTM: Standard barrel export pattern.

This enables consumers to import from the directory path rather than the specific file, which is a standard pattern for module organization.

apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx (2)

1-12: LGTM: Story-based testing approach is effective.

Using composeStories to generate tests from Storybook stories ensures consistency between the component's documentation and test coverage. Snapshot tests provide regression protection for rendering behavior.


14-19: LGTM: Accessibility testing ensures inclusive UI.

Including automated accessibility checks with jest-axe is excellent practice, ensuring that badge components meet accessibility standards across different scenarios.

apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.stories.tsx (2)

19-41: LGTM: Decorator properly provides required context.

The decorator correctly wraps stories with both OmnichannelContext and AppRoot, providing the necessary context for rendering OmnichannelBadges. The mock data structure appropriately simulates both priority and MAC limit states.


46-68: LGTM: Story variants cover key scenarios.

The two stories effectively demonstrate different badge rendering states:

  • WithPriority: Tests priority badge display
  • OverMacLimit: Tests MAC limit indicator

This provides good visual documentation and test coverage for the component's different states.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 95840d6 and 1e690f4.

⛔ Files ignored due to path filters (1)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/__snapshots__/OmnichannelBadges.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (7)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx (0 hunks)
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx (1 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.stories.tsx (1 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx (2 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/index.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/index.ts
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.stories.tsx
🧰 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/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
🧠 Learnings (11)
📚 Learning: 2025-11-27T17:56:26.050Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.050Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.

Applied to files:

  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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 **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
🧬 Code graph analysis (2)
apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1)
packages/core-typings/src/IRoom.ts (2)
  • IRoom (21-95)
  • isOmnichannelRoom (361-361)
apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx (1)
packages/core-typings/src/IRoom.ts (1)
  • isOmnichannelRoom (361-361)
⏰ 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 (7)
apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx (1)

1-24: Well-factored badge wrapper; hook and type usage look solid

The component cleanly encapsulates unread and omnichannel badge logic: useUnreadDisplay(room) is used once, unread rendering is correctly guarded by showUnread, and isOmnichannelRoom(room) is applied before rendering OmnichannelBadges. The SubscriptionWithRoom prop type is appropriate for both the unread hook and the omnichannel type guard, and the fragment-based return keeps this reusable across different sidebar layouts. No issues spotted.

apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx (3)

1-5: LGTM!

The imports are appropriate for Storybook-driven component tests with accessibility checking.


7-7: LGTM!

The test case generation from Storybook stories follows the standard pattern and includes a sensible fallback for story names.


14-19: LGTM!

The accessibility test correctly uses async/await for the axe analysis and follows the standard pattern for jest-axe validation.

apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1)

1-25: LGTM! Clean refactor that consolidates badge rendering.

The component effectively extracts badge rendering logic into a reusable, testable unit. The use of useUnreadDisplay centralizes unread calculations, and the conditional rendering for both UnreadBadge and OmnichannelBadges is straightforward and correct.

apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx (2)

4-6: The relative import paths all resolve correctly. useOmnichannelPriorities exists at apps/meteor/client/views/omnichannel/hooks/useOmnichannelPriorities.ts, PriorityIcon at apps/meteor/client/views/omnichannel/priorities/PriorityIcon.tsx, and RoomActivityIcon at apps/meteor/client/views/omnichannel/components/RoomActivityIcon.tsx.


8-23: All imports of OmnichannelBadges have been correctly updated to use the default export.

Verification confirms no outdated named imports (import { OmnichannelBadges }) exist in the codebase. All three consumer files now use the correct default import pattern:

  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.stories.tsx
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx

The index.ts file properly re-exports the default, maintaining a clean export structure.

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 (1)
apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1)

32-32: Typos already corrected.

The test names correctly use "should" rather than "shound" as flagged in the previous review.

Also applies to: 41-41

🧹 Nitpick comments (1)
apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx (1)

4-23: Export refactor and omnichannel guard look correct

The component keeps the previous behavior (priority + activity badges guarded by isOmnichannelRoom) while switching cleanly to a default export and updated import paths; hook usage is safe and typing room as ISubscription & IRoom is consistent with the existing pattern. If this prop shape is reused elsewhere in the future, you could optionally extract a type OmnichannelBadgesProps = { room: ISubscription & IRoom }; for reuse, but it’s not necessary for this change.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 15f6577 and e6658db.

⛔ Files ignored due to path filters (1)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/__snapshots__/OmnichannelBadges.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (9)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx (0 hunks)
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx (1 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.stories.tsx (1 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx (2 hunks)
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/index.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/meteor/client/sidebarv2/badges/OmnichannelBadges.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.stories.tsx
🧰 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/omnichannel/components/OmnichannelBadges/index.ts
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx
  • apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx
  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
🧠 Learnings (15)
📚 Learning: 2025-11-27T17:56:26.050Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.050Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.

Applied to files:

  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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 **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 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.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests

Applied to files:

  • apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
🧬 Code graph analysis (3)
apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1)
packages/core-typings/src/IRoom.ts (2)
  • IRoom (21-95)
  • isOmnichannelRoom (361-361)
apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.tsx (1)
packages/core-typings/src/IRoom.ts (1)
  • IRoom (21-95)
apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx (1)
packages/core-typings/src/IRoom.ts (1)
  • isOmnichannelRoom (361-361)
⏰ 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 (8)
apps/meteor/client/views/omnichannel/components/OmnichannelBadges/OmnichannelBadges.spec.tsx (1)

1-19: Story-based snapshot + a11y coverage looks solid

Data-driven tests over all composed stories with a snapshot plus an axe check is a good balance of coverage and maintenance, and the test names clearly describe the expectations. No changes needed here.

apps/meteor/client/views/omnichannel/components/OmnichannelBadges/index.ts (1)

1-1: Barrel re-export matches new default export

The index file correctly re-exports the default OmnichannelBadges component, aligning with the refactor and keeping import paths stable.

apps/meteor/client/sidebarv2/badges/SidebarItemBadges.tsx (4)

8-11: LGTM!

The type definition is clear, concise, and properly typed.


24-24: LGTM!

Default export is appropriate for this component.


13-22: Verify the useUnreadDisplay hook signature matches the room parameter type.

The component passes room (type SubscriptionWithRoom) to the useUnreadDisplay hook. Confirm that the hook's parameter type is compatible with SubscriptionWithRoom, especially if the hook was recently updated to accept UnreadData instead. Check the hook's actual signature in useUnreadDisplay.ts to ensure there is no type mismatch.


5-5: No issues found. The OmnichannelBadges import path ../../views/omnichannel/components/OmnichannelBadges is correct and resolves to the component via the index.ts barrel file, which properly re-exports the default export from OmnichannelBadges.tsx. The import statement uses the correct default import syntax.

apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1)

1-61: LGTM! Comprehensive test coverage.

The test suite is well-structured with proper mocking, clear test cases covering both positive and negative scenarios for UnreadBadge and OmnichannelBadges rendering, and appropriate use of React Testing Library patterns.

apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1)

14-23: LGTM! Clean component structure.

The component logic is well-organized with appropriate conditional rendering for UnreadBadge and OmnichannelBadges, good use of the useUnreadDisplay hook for state management, and proper encapsulation of badge display logic.

Copy link
Member

@dougfabris dougfabris left a comment

Choose a reason for hiding this comment

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

Can't u replace ISubscription & Room with SubscriptionWithRoom in the whole work?

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/meteor/client/sidebar/RoomList/RoomListRow.tsx (1)

2-59: Add string union type for item prop

The useRoomList hook inserts section header strings (like 'Channels', 'Direct_Messages') alongside room objects into the list (line 141 in useRoomList.ts: return [key, ...group]), but RoomListRow's item prop is typed only as SubscriptionWithRoom. The component correctly handles both cases with typeof item === 'string', but the type annotation must match:

-const RoomListRow = ({ data, item }: { data: RoomListRowProps; item: SubscriptionWithRoom }): ReactElement => {
+const RoomListRow = ({ data, item }: { data: RoomListRowProps; item: SubscriptionWithRoom | string }): ReactElement => {

This restores proper type narrowing so TypeScript correctly infers the type in each branch.

🧹 Nitpick comments (3)
apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1)

34-40: Consider a more explicit assertion pattern.

The test correctly verifies that UnreadBadge doesn't render when there are no unread messages. However, the accessible name 'Test Room' doesn't match any expected pattern and is somewhat arbitrary. For clarity, consider querying without a specific name or checking that no unread-related status elements exist.

Example alternative:

-		expect(screen.queryByRole('status', { name: 'Test Room' })).not.toBeInTheDocument();
+		expect(screen.queryByRole('status', { name: /mention.*Test Room/ })).not.toBeInTheDocument();

Or verify no UnreadBadge-related status exists by checking all status elements don't match the unread pattern.

apps/meteor/client/sidebar/RoomList/RoomList.tsx (1)

5-22: Align computeItemKey typing with actual roomsList item shape

useRoomList returns a heterogeneous list (section label strings plus room-like entries), but computeItemKey is typed as if it only ever receives SubscriptionWithRoom. At runtime this works because room._id just evaluates to undefined for non-room entries and falls back to index, but the current signature misrepresents the data shape and can mislead TypeScript consumers.

Consider widening the parameter type (e.g., union that matches useRoomList’s item type, or even unknown with a small runtime type guard for _id) so the key function’s typing stays honest with the actual data flowing through Virtuoso.

apps/meteor/client/sidebar/hooks/useRoomList.ts (1)

1-59: Make useRoomList return type reflect the mixed item list

useRoomList is declared to return SubscriptionWithRoom[], and the debounced state is typed the same way:

export const useRoomList = (): SubscriptionWithRoom[] => {
  const [roomList, setRoomList] = useDebouncedState<SubscriptionWithRoom[]>([], 150);

But the constructed array actually contains:

  • Section label strings (key),
  • Room subscription entries (room),
  • Livechat inquiries from queue: ILivechatInquiryRecord[].

So the true item shape is a union, not a pure SubscriptionWithRoom. The current typing relies on any escaping from groups and weakens static guarantees for all consumers (including RoomListRow, which still relies on string headers).

Consider introducing a dedicated union type for the room list items and using it consistently:

-import type { SubscriptionWithRoom } from '@rocket.chat/ui-contexts';
+import type { SubscriptionWithRoom } from '@rocket.chat/ui-contexts';

+type RoomListItem = SubscriptionWithRoom | ILivechatInquiryRecord | string;

-export const useRoomList = (): SubscriptionWithRoom[] => {
-  const [roomList, setRoomList] = useDebouncedState<SubscriptionWithRoom[]>([], 150);
+export const useRoomList = (): RoomListItem[] => {
+  const [roomList, setRoomList] = useDebouncedState<RoomListItem[]>([], 150);

This keeps the hook’s contract aligned with what it actually returns and makes downstream components’ typings (like RoomListRow) easier to keep correct.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e6658db and 6e48946.

📒 Files selected for processing (9)
  • apps/meteor/client/sidebar/RoomList/RoomList.tsx (2 hunks)
  • apps/meteor/client/sidebar/RoomList/RoomListRow.tsx (2 hunks)
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (5 hunks)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/sidebar/hooks/useAvatarTemplate.tsx (2 hunks)
  • apps/meteor/client/sidebar/hooks/useRoomList.ts (2 hunks)
  • apps/meteor/client/sidebar/search/Row.tsx (1 hunks)
  • apps/meteor/client/sidebar/search/SearchList.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
🧰 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/sidebar/search/Row.tsx
  • apps/meteor/client/sidebar/RoomList/RoomListRow.tsx
  • apps/meteor/client/sidebar/hooks/useRoomList.ts
  • apps/meteor/client/sidebar/RoomList/RoomList.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/search/SearchList.tsx
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx
  • apps/meteor/client/sidebar/hooks/useAvatarTemplate.tsx
🧠 Learnings (16)
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings by mapping subscription documents to room IDs, never undefined, even when user has no room subscriptions.

Applied to files:

  • apps/meteor/client/sidebar/search/Row.tsx
  • apps/meteor/client/sidebar/RoomList/RoomListRow.tsx
  • apps/meteor/client/sidebar/hooks/useRoomList.ts
  • apps/meteor/client/sidebar/RoomList/RoomList.tsx
  • apps/meteor/client/sidebar/search/SearchList.tsx
  • apps/meteor/client/sidebar/hooks/useAvatarTemplate.tsx
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings (mapping subscription documents to room IDs), never undefined, even when user has no room subscriptions.

Applied to files:

  • apps/meteor/client/sidebar/search/Row.tsx
  • apps/meteor/client/sidebar/RoomList/RoomListRow.tsx
  • apps/meteor/client/sidebar/hooks/useRoomList.ts
  • apps/meteor/client/sidebar/RoomList/RoomList.tsx
  • apps/meteor/client/sidebar/search/SearchList.tsx
  • apps/meteor/client/sidebar/hooks/useAvatarTemplate.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/RoomList/RoomListRow.tsx
  • apps/meteor/client/sidebar/hooks/useRoomList.ts
  • apps/meteor/client/sidebar/search/SearchList.tsx
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx
  • apps/meteor/client/sidebar/hooks/useAvatarTemplate.tsx
📚 Learning: 2025-11-27T17:56:26.050Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.050Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.

Applied to files:

  • apps/meteor/client/sidebar/hooks/useRoomList.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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 Learning: 2025-12-10T21:00:43.645Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:43.645Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.

Applied to files:

  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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 **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/search/SearchList.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 Learning: 2025-11-19T18:20:07.720Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: packages/i18n/src/locales/en.i18n.json:918-921
Timestamp: 2025-11-19T18:20:07.720Z
Learning: Repo: RocketChat/Rocket.Chat — i18n/formatting
Learning: This repository uses a custom message formatting parser in UI blocks/messages; do not assume standard Markdown rules. For keys like Call_ended_bold, Call_not_answered_bold, Call_failed_bold, and Call_transferred_bold in packages/i18n/src/locales/en.i18n.json, retain the existing single-asterisk emphasis unless maintainers request otherwise.

Applied to files:

  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx
🧬 Code graph analysis (2)
apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (2)
packages/mock-providers/src/index.ts (1)
  • mockAppRoot (3-3)
apps/meteor/tests/mocks/data.ts (1)
  • createFakeSubscription (63-90)
apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (1)
apps/meteor/client/sidebar/hooks/useUnreadDisplay.tsx (1)
  • useUnreadDisplay (6-10)
⏰ 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 (11)
apps/meteor/client/sidebar/search/Row.tsx (1)

1-11: LGTM! Clean type migration.

The type update from ISubscription & IRoom to SubscriptionWithRoom is consistent with the PR's broader refactoring objectives. The component logic remains unchanged, ensuring no behavioral impact.

apps/meteor/client/sidebar/search/SearchList.tsx (1)

6-71: LGTM! Type update aligns with refactoring.

The return type change from (ISubscription & IRoom)[] to SubscriptionWithRoom[] is consistent with the broader type migration across search components. The query logic and data processing remain unchanged, ensuring functional parity.

apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (4)

1-10: LGTM! Clean test setup.

The imports and mock configuration are well-structured. The OmnichannelBadges mock correctly uses role='status' and aria-label for testability.


12-24: LGTM! Proper test suite configuration.

The test setup provides all necessary translations and ensures proper test isolation with the afterEach cleanup hook.


26-32: LGTM! Well-structured positive test case.

The test correctly verifies UnreadBadge rendering with appropriate accessible name assertion matching the translation pattern.


42-52: LGTM! Comprehensive omnichannel badge coverage.

Both test cases correctly validate the conditional rendering of OmnichannelBadges based on room type, with appropriate positive and negative assertions.

apps/meteor/client/sidebar/hooks/useAvatarTemplate.tsx (1)

34-34: Consider documenting the rid || _id fallback pattern.

The defensive fallback room.rid || room._id suggests that rid might not always be present on the room object, which could indicate either optional typing or a type mismatch. If SubscriptionWithRoom makes rid optional, this is correct defensive coding. However, if rid is typed as required but can be undefined at runtime, this represents a type safety gap.

apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (4)

1-4: SubscriptionWithRoom migration and badge imports look consistent

Switching room to SubscriptionWithRoom in getMessage and RoomListRowProps, plus routing badge concerns through SidebarItemBadges, is coherent with the new unread/badge architecture and stays compatible with the existing room helpers used here. No issues spotted in these type/import changes.

Also applies to: 17-21, 67-68


97-100: Unread display refactor via useUnreadDisplay is coherent

Destructuring unread = 0 and delegating unreadCount, unreadTitle, showUnread, and highlightUnread to useUnreadDisplay(room) cleanly removes local unread math and keeps highlighted as the single source for unread styling. The default for unread preserves prior semantics while avoiding undefined cases; this segment looks solid.


151-156: threadUnread now derives from unreadCount.threads, which is mathematically equivalent to prior logic

The change to threadUnread={unreadCount.threads > 0} is a safe refactor rather than a behavioral change. unreadCount.threads is computed as tunread?.length || 0 in getSubscriptionUnreadData, making the condition semantically identical to checking whether the thread unread array has entries. The pattern is applied consistently across sidebar, sidebarv2, and sidepanel implementations, and unreadCount is always guaranteed to return with a numeric threads field.


139-145: ARIA label and SidebarItemBadges integration are correct

The __unreadTitle__from__roomTitle__ i18n key is defined in all supported locales (en, sv, pt-BR, nb), and SidebarItemBadges properly encapsulates both unread and omnichannel badge rendering. Test coverage confirms full badge parity: unread badges render when showUnread is true with the correct aria-label format, and omnichannel badges render for omnichannel rooms (type 'l').

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1)

34-40: Optional: align negative unread assertion with positive case name

The negative test currently checks for absence of a status element named 'Test Room'. To mirror the positive case more tightly and make intent clearer, you could assert against the same pattern used in the positive test, e.g. '1 mention from Test Room' (or a regex that matches the unread label format). This would better document that the unread badge (with its specific accessible name) disappears when there are no unread messages.

-		expect(screen.queryByRole('status', { name: 'Test Room' })).not.toBeInTheDocument();
+		expect(screen.queryByRole('status', { name: '1 mention from Test Room' })).not.toBeInTheDocument();
apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (1)

97-100: Consider unifying unread semantics between row and RoomMenu

useUnreadDisplay(room) now drives highlighted, showUnread, unreadTitle, and unreadCount.threads, while RoomMenu still receives unread={!!unread} from the raw room object:

  • Row highlight + data-unread rely on highlightUnread.
  • aria-label uses showUnread/unreadTitle and the __unreadTitle__from__roomTitle__ key, matching the new tests and improving a11y.
  • Thread indicator uses unreadCount.threads > 0, which is consistent with the unread aggregation logic.

If useUnreadDisplay becomes the canonical source of truth for unread state, you might eventually want RoomMenu’s unread prop to also be derived from that (e.g., from unreadCount.total or showUnread) rather than the raw unread field, to avoid potential divergence if unread semantics evolve.

Also applies to: 139-146, 153-156

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6e48946 and 5aa2110.

📒 Files selected for processing (9)
  • apps/meteor/client/sidebar/RoomList/RoomList.tsx (2 hunks)
  • apps/meteor/client/sidebar/RoomList/RoomListRow.tsx (2 hunks)
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (5 hunks)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1 hunks)
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1 hunks)
  • apps/meteor/client/sidebar/hooks/useAvatarTemplate.tsx (2 hunks)
  • apps/meteor/client/sidebar/hooks/useRoomList.ts (2 hunks)
  • apps/meteor/client/sidebar/search/Row.tsx (1 hunks)
  • apps/meteor/client/sidebar/search/SearchList.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/meteor/client/sidebar/hooks/useRoomList.ts
  • apps/meteor/client/sidebar/RoomList/RoomListRow.tsx
  • apps/meteor/client/sidebar/hooks/useAvatarTemplate.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
🧰 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/sidebar/RoomList/RoomList.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
  • apps/meteor/client/sidebar/search/SearchList.tsx
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx
  • apps/meteor/client/sidebar/search/Row.tsx
🧠 Learnings (15)
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings by mapping subscription documents to room IDs, never undefined, even when user has no room subscriptions.

Applied to files:

  • apps/meteor/client/sidebar/RoomList/RoomList.tsx
  • apps/meteor/client/sidebar/search/SearchList.tsx
  • apps/meteor/client/sidebar/search/Row.tsx
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings (mapping subscription documents to room IDs), never undefined, even when user has no room subscriptions.

Applied to files:

  • apps/meteor/client/sidebar/RoomList/RoomList.tsx
  • apps/meteor/client/sidebar/search/SearchList.tsx
  • apps/meteor/client/sidebar/search/Row.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 Learning: 2025-12-10T21:00:43.645Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:43.645Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.

Applied to files:

  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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 **/*.spec.ts : Use descriptive test names that clearly communicate expected behavior in Playwright tests

Applied to files:

  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 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/client/sidebar/badges/SidebarItemBadges.spec.tsx
📚 Learning: 2025-10-06T20:32:23.658Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/utilities.ts:557-573
Timestamp: 2025-10-06T20:32:23.658Z
Learning: In packages/apps-engine/tests/test-data/utilities.ts, the field name `isSubscripbedViaBundle` in the `IMarketplaceSubscriptionInfo` type should not be flagged as a typo, as it may match the upstream API's field name.

Applied to files:

  • apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.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/search/SearchList.tsx
  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx
📚 Learning: 2025-11-19T18:20:07.720Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: packages/i18n/src/locales/en.i18n.json:918-921
Timestamp: 2025-11-19T18:20:07.720Z
Learning: Repo: RocketChat/Rocket.Chat — i18n/formatting
Learning: This repository uses a custom message formatting parser in UI blocks/messages; do not assume standard Markdown rules. For keys like Call_ended_bold, Call_not_answered_bold, Call_failed_bold, and Call_transferred_bold in packages/i18n/src/locales/en.i18n.json, retain the existing single-asterisk emphasis unless maintainers request otherwise.

Applied to files:

  • apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx
🧬 Code graph analysis (2)
apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (2)
packages/mock-providers/src/index.ts (1)
  • mockAppRoot (3-3)
apps/meteor/tests/mocks/data.ts (1)
  • createFakeSubscription (63-90)
apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (1)
apps/meteor/client/sidebar/hooks/useUnreadDisplay.tsx (1)
  • useUnreadDisplay (6-10)
⏰ 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 (5)
apps/meteor/client/sidebar/search/Row.tsx (1)

1-11: LGTM! Type update aligns with refactor.

The change from ISubscription & IRoom to SubscriptionWithRoom is a clean type consolidation with no behavioral impact.

apps/meteor/client/sidebar/RoomList/RoomList.tsx (1)

5-5: LGTM! Function signature updated correctly.

The computeItemKey type update from IRoom to SubscriptionWithRoom is consistent with the broader refactor. The implementation remains unchanged.

Also applies to: 22-22

apps/meteor/client/sidebar/search/SearchList.tsx (1)

6-6: LGTM! Hook return type updated correctly.

The useSearchItems return type change to SubscriptionWithRoom[] aligns with the type consolidation across sidebar components. No implementation changes.

Also applies to: 71-71

apps/meteor/client/sidebar/badges/SidebarItemBadges.spec.tsx (1)

7-53: Well‑structured RTL tests with good a11y‑oriented assertions

The suite cleanly sets up translations via mockAppRoot, uses createFakeSubscription overrides to pin unread/mention state, and tests behavior through role="status" queries and accessible names. The OmnichannelBadges mock isolates SidebarItemBadges logic without coupling tests to its internal markup. Overall, this is solid and focused coverage for unread vs. omnichannel badges.

apps/meteor/client/sidebar/RoomList/SideBarItemTemplateWithData.tsx (1)

1-4: Typed move to SubscriptionWithRoom and hook integration looks consistent

Updating getMessage and RoomListRowProps.room to SubscriptionWithRoom, importing the new useUnreadDisplay hook, and wiring in SidebarItemBadges are all consistent with the shift toward a unified subscription+room shape. The types line up with existing usage of isDirectMessageRoom/isMultipleDirectMessageRoom, and the new badges component centralizes unread/omnichannel UI nicely without changing call‑sites’ responsibilities.

Also applies to: 17-21, 67-68

Copy link
Member

@dougfabris dougfabris left a comment

Choose a reason for hiding this comment

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

LGTM!

@aleksandernsilva aleksandernsilva added the stat: QA assured Means it has been tested and approved by a company insider label Dec 11, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Dec 11, 2025
@aleksandernsilva aleksandernsilva removed the stat: QA assured Means it has been tested and approved by a company insider label Dec 11, 2025
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Dec 11, 2025
@aleksandernsilva aleksandernsilva added the stat: QA assured Means it has been tested and approved by a company insider label Dec 11, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Dec 11, 2025
@kodiakhq kodiakhq bot merged commit 855fae2 into develop Dec 12, 2025
88 of 90 checks passed
@kodiakhq kodiakhq bot deleted the refactor/sidebar-badges branch December 12, 2025 13:52
ricardogarim pushed a commit that referenced this pull request Dec 15, 2025
@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.

2 participants