fix: Restore 'Reply in Direct Message' action in web client
Closed
KU
6mo ago+11+11+01234567890123456789-26-26-01234567890123456789
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 :
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
canReplyInDMlogic 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
canReplyInDMto check for core requirements: User is logged in, hascreate-dpermission, is not the author, and is in a valid room type (Channel/Group). - Cleanup: Removed several unused imports (
useShallow,useCallback,useRooms,useSubscriptions) and optimized theuseMemodependencies.
Issue(s)
Closes #39434
Steps to test or reproduce
- Open Rocket.Chat in a web browser.
- Navigate to a public channel.
- Find a message from a user you have never had a Direct Message conversation with before.
- Open the message action menu (three dots).
- Expected: The "Reply in Direct Message" option should be visible.
- 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.