Skip to content

Commit

Permalink
disable chat opening when item is active and shouldAllowChatAutoOpen …
Browse files Browse the repository at this point in the history
…is null
  • Loading branch information
andreymikhadyuk committed Aug 29, 2023
1 parent 5989484 commit eb3c4c7
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,13 @@ const DiscussionFeedCard = forwardRef<FeedItemRef, DiscussionFeedCardProps>(

useEffect(() => {
if (
!isActive &&
(!isActive ||
shouldAllowChatAutoOpen === null ||
shouldAllowChatAutoOpen) &&
isDiscussionFetched &&
isFeedItemUserMetadataFetched &&
item.id === feedItemIdForAutoChatOpen &&
!isMobileVersion &&
shouldAllowChatAutoOpen !== false
!isMobileVersion
) {
handleOpenChat();
}
Expand All @@ -225,10 +226,10 @@ const DiscussionFeedCard = forwardRef<FeedItemRef, DiscussionFeedCardProps>(
]);

useEffect(() => {
if (isActive) {
if (isActive && shouldAllowChatAutoOpen !== null) {
handleOpenChat();
}
}, [isActive, handleOpenChat]);
}, [isActive, shouldAllowChatAutoOpen, handleOpenChat]);

useEffect(() => {
if (isActive && cardTitle) {
Expand Down

0 comments on commit eb3c4c7

Please sign in to comment.