From 4686fecaa9afbc74d1bc0e078c4b1507fb5fda12 Mon Sep 17 00:00:00 2001 From: Kush Kumar Date: Sat, 7 Mar 2026 11:29:18 +0000 Subject: [PATCH 1/3] fix: restore 'Reply in DM' action in web client (fixes #39434) --- .../message/toolbar/useReplyInDMAction.ts | 29 +++---------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts b/apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts index 588ab0a607624..31021b24036e7 100644 --- a/apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts +++ b/apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts @@ -1,13 +1,11 @@ import { type IMessage, type ISubscription, type IRoom, isE2EEMessage } from '@rocket.chat/core-typings'; import { useEmbeddedLayout } from '@rocket.chat/ui-client'; import { usePermission, useRouter, useUser } from '@rocket.chat/ui-contexts'; -import { useCallback, useMemo } from 'react'; +import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { useShallow } from 'zustand/shallow'; import type { MessageActionConfig } from '../../../../app/ui-utils/client/lib/MessageAction'; import { roomCoordinator } from '../../../lib/rooms/roomCoordinator'; -import { Rooms, Subscriptions } from '../../../stores'; export const useReplyInDMAction = ( message: IMessage, @@ -21,23 +19,6 @@ export const useReplyInDMAction = ( const isLayoutEmbedded = useEmbeddedLayout(); const { t } = useTranslation(); - const roomPredicate = useCallback( - (record: IRoom): boolean => { - const ids = [user?._id, message.u._id].sort().join(''); - return ids.includes(record._id); - }, - [message.u._id, user], - ); - - const shouldFindRoom = useMemo(() => !!user && canCreateDM && user._id !== message.u._id, [canCreateDM, message.u._id, user]); - const dmRoom = Rooms.use(useShallow((state) => (shouldFindRoom ? state.find(roomPredicate) : undefined))); - - const subsPredicate = useCallback( - (record: ISubscription) => record.rid === dmRoom?._id || record.u._id === user?._id, - [dmRoom, user?._id], - ); - const dmSubs = Subscriptions.use(useShallow((state) => state.find(subsPredicate))); - const tooltip = useMemo(() => { if (encrypted) { return t('Action_not_available_encrypted_content', { action: t('Reply_in_direct_message') }); @@ -52,13 +33,11 @@ export const useReplyInDMAction = ( if (!subscription || room.t === 'd' || room.t === 'l' || isLayoutEmbedded) { return false; } - if (!!user && user._id !== message.u._id && canCreateDM) { - if (!dmRoom || !dmSubs) { - return false; - } + if (!user || user._id === message.u._id || !canCreateDM) { + return false; } return true; - }, [canCreateDM, dmRoom, dmSubs, isLayoutEmbedded, message.u._id, room.t, subscription, user]); + }, [canCreateDM, isLayoutEmbedded, message.u._id, room.t, subscription, user]); if (!canReplyInDM) { return null; From 3988baa39e9c20f8c60d94d64422852b69ef8fe1 Mon Sep 17 00:00:00 2001 From: Kush Kumar Date: Sat, 7 Mar 2026 11:36:28 +0000 Subject: [PATCH 2/3] fix: improve visibility of 'Reply in Direct Message' action by removing redundant checks --- .changeset/dull-boats-vanish.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/dull-boats-vanish.md diff --git a/.changeset/dull-boats-vanish.md b/.changeset/dull-boats-vanish.md new file mode 100644 index 0000000000000..e5eb361027f34 --- /dev/null +++ b/.changeset/dull-boats-vanish.md @@ -0,0 +1,6 @@ +--- +'@rocket.chat/meteor': patch +'@rocket.chat/ui-client': patch +--- + +Fixed 'Reply in Direct Message' action visibility by removing redundant local store checks From df290f2dcf09e6d193fb437b2e95137091a92e61 Mon Sep 17 00:00:00 2001 From: Kush Kumar Date: Sat, 7 Mar 2026 11:49:33 +0000 Subject: [PATCH 3/3] fix: update conditions for 'Reply in Direct Message' action to ensure proper functionality --- .../client/components/message/toolbar/useReplyInDMAction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts b/apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts index 31021b24036e7..fd9eb218d537b 100644 --- a/apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts +++ b/apps/meteor/client/components/message/toolbar/useReplyInDMAction.ts @@ -30,7 +30,7 @@ export const useReplyInDMAction = ( }, [encrypted, isABACEnabled, t]); const canReplyInDM = useMemo(() => { - if (!subscription || room.t === 'd' || room.t === 'l' || isLayoutEmbedded) { + if (!subscription || (room.t !== 'c' && room.t !== 'p') || isLayoutEmbedded) { return false; } if (!user || user._id === message.u._id || !canCreateDM) {