Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix#29173:Chat - The New Line Marker does not appear for unread first message #29697

Merged
merged 7 commits into from
Oct 21, 2023
7 changes: 6 additions & 1 deletion src/pages/home/report/ReportActionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import reportPropTypes from '../../reportPropTypes';
import FloatingMessageCounter from './FloatingMessageCounter';
import ReportActionsListItemRenderer from './ReportActionsListItemRenderer';
import reportActionPropTypes from './reportActionPropTypes';
import * as ReportActionsUtils from '../../../libs/ReportActionsUtils';

const propTypes = {
/** The report currently being looked at */
Expand Down Expand Up @@ -97,6 +98,10 @@ function keyExtractor(item) {
}

function isMessageUnread(message, lastReadTime) {
if (!lastReadTime) {
return Boolean(!ReportActionsUtils.isCreatedAction(message));
}

return Boolean(message && lastReadTime && message.created && lastReadTime < message.created);
}

Expand Down Expand Up @@ -288,7 +293,7 @@ function ReportActionsList({
if (!currentUnreadMarker) {
const nextMessage = sortedReportActions[index + 1];
const isCurrentMessageUnread = isMessageUnread(reportAction, report.lastReadTime);
shouldDisplay = isCurrentMessageUnread && !isMessageUnread(nextMessage, report.lastReadTime);
shouldDisplay = isCurrentMessageUnread && (!nextMessage || !isMessageUnread(nextMessage, report.lastReadTime));
if (!messageManuallyMarkedUnread) {
shouldDisplay = shouldDisplay && reportAction.actorAccountID !== Report.getCurrentUserAccountID();
}
Expand Down
Loading