From eb3c4c79d1ee247674411b00621333fab162747c Mon Sep 17 00:00:00 2001 From: Andrey Mikhadyuk Date: Tue, 29 Aug 2023 15:34:52 +0300 Subject: [PATCH] disable chat opening when item is active and shouldAllowChatAutoOpen is null --- .../DiscussionFeedCard/DiscussionFeedCard.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pages/common/components/DiscussionFeedCard/DiscussionFeedCard.tsx b/src/pages/common/components/DiscussionFeedCard/DiscussionFeedCard.tsx index 2f5deade12..cc7951603e 100644 --- a/src/pages/common/components/DiscussionFeedCard/DiscussionFeedCard.tsx +++ b/src/pages/common/components/DiscussionFeedCard/DiscussionFeedCard.tsx @@ -209,12 +209,13 @@ const DiscussionFeedCard = forwardRef( useEffect(() => { if ( - !isActive && + (!isActive || + shouldAllowChatAutoOpen === null || + shouldAllowChatAutoOpen) && isDiscussionFetched && isFeedItemUserMetadataFetched && item.id === feedItemIdForAutoChatOpen && - !isMobileVersion && - shouldAllowChatAutoOpen !== false + !isMobileVersion ) { handleOpenChat(); } @@ -225,10 +226,10 @@ const DiscussionFeedCard = forwardRef( ]); useEffect(() => { - if (isActive) { + if (isActive && shouldAllowChatAutoOpen !== null) { handleOpenChat(); } - }, [isActive, handleOpenChat]); + }, [isActive, shouldAllowChatAutoOpen, handleOpenChat]); useEffect(() => { if (isActive && cardTitle) {