From 90c90db355ea98b3465c07dacd49a26750d32bcd Mon Sep 17 00:00:00 2001 From: Vigneshkumar Chinnachamy M Date: Thu, 12 Oct 2023 20:07:39 +0530 Subject: [PATCH 1/2] Fix#29173:Chat - The New Line Marker does not appear for unread first message --- src/pages/home/report/ReportActionsList.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionsList.js b/src/pages/home/report/ReportActionsList.js index 438b6e9b68d5..54ca1e62279b 100644 --- a/src/pages/home/report/ReportActionsList.js +++ b/src/pages/home/report/ReportActionsList.js @@ -23,6 +23,7 @@ import reportPropTypes from '../../reportPropTypes'; import FloatingMessageCounter from './FloatingMessageCounter'; import ReportActionsListItemRenderer from './ReportActionsListItemRenderer'; import reportActionPropTypes from './reportActionPropTypes'; +import {isCreatedAction} from '../../../libs/ReportActionsUtils'; const propTypes = { /** The report currently being looked at */ @@ -97,6 +98,10 @@ function keyExtractor(item) { } function isMessageUnread(message, lastReadTime) { + if (!lastReadTime) { + return Boolean(!isCreatedAction(message)); + } + return Boolean(message && lastReadTime && message.created && lastReadTime < message.created); } @@ -289,12 +294,12 @@ function ReportActionsList({ if (!currentUnreadMarker) { const nextMessage = sortedReportActions[index + 1]; const isCurrentMessageUnread = isMessageUnread(reportAction, report.lastReadTime); - shouldDisplayNewMarker = isCurrentMessageUnread && !isMessageUnread(nextMessage, report.lastReadTime); + shouldDisplayNewMarker = isCurrentMessageUnread && (!nextMessage || !isMessageUnread(nextMessage, report.lastReadTime)); if (!messageManuallyMarkedUnread) { shouldDisplayNewMarker = shouldDisplayNewMarker && reportAction.actorAccountID !== Report.getCurrentUserAccountID(); } - const canDisplayMarker = scrollingVerticalOffset.current < MSG_VISIBLE_THRESHOLD ? reportAction.created < userActiveSince.current : true; + const canDisplayMarker = scrollingVerticalOffset.current < MSG_VISIBLE_THRESHOLD && userActiveSince.current ? reportAction.created < userActiveSince.current : true; if (!currentUnreadMarker && shouldDisplayNewMarker && canDisplayMarker) { setCurrentUnreadMarker(reportAction.reportActionID); From c3408284dd2d3931f6617d2ca9fccb8188c45374 Mon Sep 17 00:00:00 2001 From: Vigneshkumar Chinnachamy M Date: Fri, 20 Oct 2023 10:00:06 +0530 Subject: [PATCH 2/2] Fix lint --- src/pages/home/report/ReportActionsList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionsList.js b/src/pages/home/report/ReportActionsList.js index 794233770e04..ab8a896c8dbf 100644 --- a/src/pages/home/report/ReportActionsList.js +++ b/src/pages/home/report/ReportActionsList.js @@ -23,7 +23,7 @@ import reportPropTypes from '../../reportPropTypes'; import FloatingMessageCounter from './FloatingMessageCounter'; import ReportActionsListItemRenderer from './ReportActionsListItemRenderer'; import reportActionPropTypes from './reportActionPropTypes'; -import {isCreatedAction} from '../../../libs/ReportActionsUtils'; +import * as ReportActionsUtils from '../../../libs/ReportActionsUtils'; const propTypes = { /** The report currently being looked at */ @@ -99,7 +99,7 @@ function keyExtractor(item) { function isMessageUnread(message, lastReadTime) { if (!lastReadTime) { - return Boolean(!isCreatedAction(message)); + return Boolean(!ReportActionsUtils.isCreatedAction(message)); } return Boolean(message && lastReadTime && message.created && lastReadTime < message.created);