Skip to content

fix: Restore 'Reply in Direct Message' action in web client#39440

Open
kushkumarkashyap7280 wants to merge 3 commits intoRocketChat:developfrom
kushkumarkashyap7280:fix/39434-reply-in-dm-web-missing
Open

fix: Restore 'Reply in Direct Message' action in web client#39440
kushkumarkashyap7280 wants to merge 3 commits intoRocketChat:developfrom
kushkumarkashyap7280:fix/39434-reply-in-dm-web-missing

Conversation

@kushkumarkashyap7280
Copy link

@kushkumarkashyap7280 kushkumarkashyap7280 commented Mar 7, 2026

Proposed changes (including videos or screenshots)

This PR restores the "Reply in Direct Message" message action in the web/desktop application, achieving feature parity with the mobile app.

screenshot :
Screenshot From 2026-03-07 17-00-10

Technical Root Cause:
The useReplyInDMAction hook previously relied on local client-side Rooms and Subscriptions stores to determine if a DM room already existed between the current user and the message author.

  • If a DM conversation had never been initiated, these stores returned undefined.
  • The canReplyInDM logic required these to be truthy, effectively hiding the button for any new potential conversations.

The Fix:

  • Decoupled Visibility from State: Removed the dependency on local room/subscription stores.
  • Simplified Logic: Refactored canReplyInDM to check for core requirements: User is logged in, has create-d permission, is not the author, and is in a valid room type (Channel/Group).
  • Cleanup: Removed several unused imports (useShallow, useCallback, useRooms, useSubscriptions) and optimized the useMemo dependencies.

Issue(s)

Closes #39434

Steps to test or reproduce

  1. Open Rocket.Chat in a web browser.
  2. Navigate to a public channel.
  3. Find a message from a user you have never had a Direct Message conversation with before.
  4. Open the message action menu (three dots).
  5. Expected: The "Reply in Direct Message" option should be visible.
  6. Actual (Before Fix): The option is missing because no pre-existing DM subscription exists in the local store.

Further comments

The roomCoordinator.openRouteLink already handles the creation of a new DM room if one does not exist, so the pre-emptive store check was redundant and caused this UI regression. Removing it ensures the feature works as intended for initiating new private discussions.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed visibility of the "Reply in Direct Message" action in message toolbars by removing redundant checks—the action now reliably appears when users are allowed to start direct-message replies.

@kushkumarkashyap7280 kushkumarkashyap7280 requested a review from a team as a code owner March 7, 2026 11:34
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Mar 7, 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

@changeset-bot
Copy link

changeset-bot bot commented Mar 7, 2026

🦋 Changeset detected

Latest commit: df290f2

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

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

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e8ba6f10-676a-406f-8940-b28ac2dd54ef

📥 Commits

Reviewing files that changed from the base of the PR and between 3988baa and df290f2.

📒 Files selected for processing (1)
  • apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: cubic · AI code reviewer

Walkthrough

Removes redundant room/subscription lookup and memoization from the "Reply in Direct Message" action, simplifying eligibility to a direct check based on target user existence, authorship, and DM creation permission.

Changes

Cohort / File(s) Summary
Changeset
/.changeset/dull-boats-vanish.md
Adds a patch changeset for @rocket.chat/meteor and @rocket.chat/ui-client documenting the fix: removed redundant local store checks that affected "Reply in Direct Message" visibility.
DM Reply Action Logic
apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts
Eliminated Rooms/Subscriptions lookups, related memoization and predicates; removed useCallback/useShallow imports; simplified canReplyInDM to a direct eligibility check (user present, not the author, DM creation allowed).

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: restoring the 'Reply in Direct Message' action in the web client, matching the PR's primary objective.
Linked Issues check ✅ Passed The PR fully addresses #39434 by removing local store dependencies that prevented the action from appearing for new DM conversations, restoring parity with mobile while maintaining permission checks.
Out of Scope Changes check ✅ Passed All changes directly support the stated objective of restoring 'Reply in Direct Message' visibility by refactoring the hook logic and removing redundant store checks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts`:
- Around line 33-40: The current visibility check in the reply-in-DM hook
incorrectly permits any room type except 'd' and 'l'; change the condition to
explicitly allow only channel or group rooms by checking room.t === 'c' ||
room.t === 'p' (along with existing checks for subscription, !isLayoutEmbedded,
user existence, user._id !== message.u._id, and canCreateDM) so the action
appears only in channels/groups; update the dependency list still referencing
canCreateDM, isLayoutEmbedded, message.u._id, room.t, subscription, user.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cca1855d-d2af-44da-b7b3-712ccc5c5f4f

📥 Commits

Reviewing files that changed from the base of the PR and between 4f43a85 and 3988baa.

📒 Files selected for processing (2)
  • .changeset/dull-boats-vanish.md
  • apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts
📜 Review details
🧰 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/components/message/toolbar/useReplyInDMAction.ts
🧠 Learnings (9)
📚 Learning: 2026-02-24T19:09:09.561Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.

Applied to files:

  • .changeset/dull-boats-vanish.md
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.

Applied to files:

  • .changeset/dull-boats-vanish.md
  • apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts
📚 Learning: 2026-02-24T19:05:56.710Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit.

Applied to files:

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

Applied to files:

  • .changeset/dull-boats-vanish.md
📚 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/components/message/toolbar/useReplyInDMAction.ts
📚 Learning: 2025-09-16T13:33:49.237Z
Learnt from: cardoso
Repo: RocketChat/Rocket.Chat PR: 36890
File: apps/meteor/tests/e2e/e2e-encryption/e2ee-otr.spec.ts:21-26
Timestamp: 2025-09-16T13:33:49.237Z
Learning: The im.delete API endpoint accepts either a `roomId` parameter (requiring the actual DM room _id) or a `username` parameter (for the DM partner's username). Constructing slug-like identifiers like `user2${Users.userE2EE.data.username}` doesn't work for this endpoint.

Applied to files:

  • apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Reply in Direct Message" button visible in mobile app but missing in web application

1 participant