From dac6c3a101d596077218eaf89a476330cb57e024 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 24 Dec 2021 01:26:01 +0100 Subject: [PATCH] Message: Fix focusing to forwarded channel post --- src/components/middle/message/hooks/useInnerHandlers.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/middle/message/hooks/useInnerHandlers.ts b/src/components/middle/message/hooks/useInnerHandlers.ts index 1b2041ea..31d9b756 100644 --- a/src/components/middle/message/hooks/useInnerHandlers.ts +++ b/src/components/middle/message/hooks/useInnerHandlers.ts @@ -50,12 +50,14 @@ export default function useInnerHandlers( return; } - if (isUserId(senderPeer.id)) { + if (forwardInfo?.channelPostId) { + focusMessage({ chatId: senderPeer.id, messageId: forwardInfo.channelPostId }); + } else if (isUserId(senderPeer.id)) { openUserInfo({ id: senderPeer.id }); } else { openChat({ id: senderPeer.id }); } - }, [senderPeer, showNotification, lang, openUserInfo, openChat]); + }, [focusMessage, forwardInfo?.channelPostId, lang, openChat, openUserInfo, senderPeer, showNotification]); const handleViaBotClick = useCallback(() => { if (!botSender) {