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

Closed
KU
6mo ago
+11-26

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.