Skip to content

Conversation

@Hardik301002
Copy link

@Hardik301002 Hardik301002 commented Jan 10, 2026

What i have done-
Adds a visible back button in the header when viewing Direct Messages.
Why-
Users had no clear or discoverable way to return to the workspace from a DM.
How-
Shows a back navigation icon in the DM header that routes back to the workspace home.

Steps to test-

  1. Open any Direct Message
  2. Click the back button in the header
  3. Verify navigation returns to the workspace

Fixes #38135

Summary by CodeRabbit

  • New Features

    • Added back button functionality in direct message rooms for improved navigation.
  • Improvements

    • Navigation controls now display consistently across all device sizes, providing a unified user experience.

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

@Hardik301002 Hardik301002 requested a review from a team as a code owner January 10, 2026 13:54
@changeset-bot
Copy link

changeset-bot bot commented Jan 10, 2026

⚠️ No Changeset found

Latest commit: 9d28efb

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

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Jan 10, 2026

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

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 10, 2026

Walkthrough

The PR simplifies NavBarControlsSection by removing mobile-specific branching and unifying rendering with conditional group displays. It also adds a back navigation button to RoomHeader for direct message rooms, addressing navigation discoverability issues when viewing DMs.

Changes

Cohort / File(s) Summary
UI Navigation Enhancement
apps/meteor/client/views/room/Header/RoomHeader.tsx
Adds back button (chevron-left icon) for direct message rooms with click handler to navigate to workspace home. Imports useHistory and IconButton components.
Navigation Bar Refactoring
apps/meteor/client/navbar/NavBarControls/NavBarControlsSection.tsx
Removes mobile-specific early return and unifies rendering into single NavBarSection. Conditionally renders NavBarVoipGroup and NavBarOmnichannelGroup based on state flags.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • tassoevan

Poem

🐰 A button appears, so clear and so bright,
Guiding lost travelers back to the light,
Mobile or desktop, the nav flows as one,
Navigation's refined—our work here is done! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The NavBarControlsSection.tsx changes refactoring mobile-specific logic appear out of scope relative to the DM back navigation objective in #38135. Review whether NavBarControlsSection.tsx changes are necessary for the back button feature; consider separating unrelated refactoring into a separate PR.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR implements the core requirement from #38135 by adding a visible back button in the DM header to navigate back to the workspace, addressing the lack of clear navigation control.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The pull request title clearly and specifically describes the main change: adding back navigation functionality for direct message rooms, which aligns with the primary objective of the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@Hardik301002 Hardik301002 changed the title Add: clear back navigation when viewing direct messages fix: Add clear back navigation when viewing direct messages Jan 10, 2026
Copy link
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 2 files

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

🤖 Fix all issues with AI agents
In @apps/meteor/client/views/room/Header/RoomHeader.tsx:
- Around line 49-59: Several lines in the RoomHeader JSX (the Header block
containing the isDirectMessage conditional and IconButton) use spaces instead of
tabs; update the indentation for that block to use tabs consistently (replace
leading spaces on the lines containing Header, the isDirectMessage conditional,
IconButton props like icon/aria-label/title/onClick, and the slots?.start line)
so the file follows the project's useTabs: true Prettier rule while keeping the
existing structure and handlers (isDirectMessage, IconButton, handleBack,
slots?.start) unchanged.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 05c415b and 9d28efb.

📒 Files selected for processing (2)
  • apps/meteor/client/navbar/NavBarControls/NavBarControlsSection.tsx
  • apps/meteor/client/views/room/Header/RoomHeader.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/room/Header/RoomHeader.tsx
  • apps/meteor/client/navbar/NavBarControls/NavBarControlsSection.tsx
⏰ 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). (1)
  • GitHub Check: cubic · AI code reviewer
🔇 Additional comments (3)
apps/meteor/client/views/room/Header/RoomHeader.tsx (2)

7-9: LGTM: Import additions are appropriate.

The imported IconButton and useHistory are correctly sourced and support the back navigation feature for direct messages.


39-45: The '/' destination is correct for back navigation. The root path acts as a navigation hub that either redirects to the user's default room or to /home (the workspace channel list), making it an appropriate destination for backing out of a direct message view.

apps/meteor/client/navbar/NavBarControls/NavBarControlsSection.tsx (1)

20-32: Verify whether mobile/desktop rendering divergence is intentional and clarify AI summary accuracy.

Two valid concerns:

  1. AI summary conflict: The summary claims this creates a "unified render path," but the code clearly maintains separate mobile (lines 20–31) and desktop (lines 35–44) branches with an early return at line 20.

  2. Mobile includes NavBarControlsWithData, desktop does not: The mobile branch conditionally renders NavBarControlsWithData (line 25) when showOmnichannel || callAction, while the desktop branch (lines 35–44) renders NavBarVoipGroup and NavBarOmnichannelGroup directly without NavBarControlsWithData.

This divergence may be intentional UX design (mobile consolidates controls into a menu component; desktop shows separate groups), but please confirm whether this asymmetry is the intended behavior.

Comment on lines +49 to +59
<Header>
{isDirectMessage && (
<IconButton
icon='chevron-left'
small
aria-label={t('Back')}
title={t('Back')}
onClick={handleBack}
/>
)}
{slots?.start}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's read the file to see the actual indentation at lines 49-59
head -60 apps/meteor/client/views/room/Header/RoomHeader.tsx | tail -20

Repository: RocketChat/Rocket.Chat

Length of output: 365


🏁 Script executed:

# Let's see a bit more context (lines 40-70) to understand the indentation pattern
head -70 apps/meteor/client/views/room/Header/RoomHeader.tsx | tail -35

Repository: RocketChat/Rocket.Chat

Length of output: 818


🏁 Script executed:

# Check if there's a prettier or eslint config to understand the project's indentation standard
find . -maxdepth 2 -type f \( -name ".prettierrc*" -o -name ".eslintrc*" -o -name "prettier.config.*" -o -name "eslint.config.*" \) | head -10

Repository: RocketChat/Rocket.Chat

Length of output: 79


🏁 Script executed:

# Check the prettier configuration
cat .prettierrc

Repository: RocketChat/Rocket.Chat

Length of output: 303


Fix indentation to use tabs throughout.

Lines 49-59 use spaces instead of tabs, violating the project's Prettier configuration (useTabs: true). The rest of the component correctly uses tabs (see line 60+). The back button placement before slots?.start is intentional and appropriate.

🔧 Proposed fix for indentation
-	   <Header>
-	    {isDirectMessage && (
-		  <IconButton
-			icon='chevron-left'
-			small
-			aria-label={t('Back')}
-			title={t('Back')}
-			onClick={handleBack}
-		  />
-  )}
-	    {slots?.start}
+		<Header>
+			{isDirectMessage && (
+				<IconButton
+					icon='chevron-left'
+					small
+					aria-label={t('Back')}
+					title={t('Back')}
+					onClick={handleBack}
+				/>
+			)}
+			{slots?.start}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Header>
{isDirectMessage && (
<IconButton
icon='chevron-left'
small
aria-label={t('Back')}
title={t('Back')}
onClick={handleBack}
/>
)}
{slots?.start}
<Header>
{isDirectMessage && (
<IconButton
icon='chevron-left'
small
aria-label={t('Back')}
title={t('Back')}
onClick={handleBack}
/>
)}
{slots?.start}
🤖 Prompt for AI Agents
In @apps/meteor/client/views/room/Header/RoomHeader.tsx around lines 49 - 59,
Several lines in the RoomHeader JSX (the Header block containing the
isDirectMessage conditional and IconButton) use spaces instead of tabs; update
the indentation for that block to use tabs consistently (replace leading spaces
on the lines containing Header, the isDirectMessage conditional, IconButton
props like icon/aria-label/title/onClick, and the slots?.start line) so the file
follows the project's useTabs: true Prettier rule while keeping the existing
structure and handlers (isDirectMessage, IconButton, handleBack, slots?.start)
unchanged.

@Hardik301002 Hardik301002 changed the title fix: Add clear back navigation when viewing direct messages fix: add clear back navigation when viewing direct messages Jan 10, 2026
@dougfabris
Copy link
Member

Hi there, thanks for the contribution! 🚀 💯

Closing this PR because it's stale now. We came up with another solution for this here.


Questions? Help needed? Feature Requests?

  • Join our Open Server in the #support channel and feel free to raise a question
  • Join our Community Forum and search/create a post there

@dougfabris dougfabris closed this Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No clear navigation back to workspace when viewing a direct message

3 participants