From cb47d4fb7fe7d97a3958d4874817737fd6ab28b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Thu, 13 Jul 2023 13:28:44 +0200 Subject: [PATCH] Fix New Messages toast showing when it should not (#23995) --- .../src/components/toast_wrapper/toast_wrapper.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/channels/src/components/toast_wrapper/toast_wrapper.tsx b/webapp/channels/src/components/toast_wrapper/toast_wrapper.tsx index 11b37d203d..439231a7a6 100644 --- a/webapp/channels/src/components/toast_wrapper/toast_wrapper.tsx +++ b/webapp/channels/src/components/toast_wrapper/toast_wrapper.tsx @@ -124,17 +124,17 @@ export class ToastWrapperClass extends React.PureComponent { } // show unread toast when a channel is marked as unread - if (props.channelMarkedAsUnread && !props.atBottom && !prevState.channelMarkedAsUnread && !prevState.showUnreadToast) { + if (props.channelMarkedAsUnread && (props.atBottom === false) && !prevState.channelMarkedAsUnread && !prevState.showUnreadToast) { showUnreadToast = true; } // show unread toast when a channel is remarked as unread using the change in lastViewedAt // lastViewedAt changes only if a channel is remarked as unread in channelMarkedAsUnread state - if (props.channelMarkedAsUnread && props.lastViewedAt !== prevState.lastViewedAt && !props.atBottom) { + if (props.channelMarkedAsUnread && props.lastViewedAt !== prevState.lastViewedAt && (props.atBottom === false)) { showUnreadToast = true; } - if (!showUnreadToast && unreadCount > 0 && !props.atBottom && props.latestPostTimeStamp && (props.lastViewedBottom < props.latestPostTimeStamp)) { + if (!showUnreadToast && unreadCount > 0 && (props.atBottom === false) && props.latestPostTimeStamp && (props.lastViewedBottom < props.latestPostTimeStamp)) { showNewMessagesToast = true; } @@ -384,7 +384,7 @@ export class ToastWrapperClass extends React.PureComponent { onDismiss: this.hideUnreadToast, onClick: this.scrollToLatestMessages, onClickMessage: localizeMessage('postlist.toast.scrollToBottom', 'Jump to recents'), - showActions: !atLatestPost || (atLatestPost && !atBottom), + showActions: !atLatestPost || (atLatestPost && (atBottom === false)), }; if (showUnreadToast && unreadCount > 0) {