diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 26280f95447d..a2401ad926d3 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3634,7 +3634,10 @@ function isUnread(report: OnyxEntry): boolean { // lastVisibleActionCreated and lastReadTime are both datetime strings and can be compared directly const lastVisibleActionCreated = report.lastVisibleActionCreated ?? ''; const lastReadTime = report.lastReadTime ?? ''; - return lastReadTime < lastVisibleActionCreated; + const lastMentionedTime = report.lastMentionedTime ?? ''; + + // If the user was mentioned and the comment got deleted the lastMentionedTime will be more recent than the lastVisibleActionCreated + return lastReadTime < lastVisibleActionCreated || lastReadTime < lastMentionedTime; } function isIOUOwnedByCurrentUser(report: OnyxEntry, allReportsDict: OnyxCollection = null): boolean { diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 6d0ac9721f07..8741006efab1 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -206,6 +206,7 @@ function ReportScreen({ oldPolicyName: reportProp.oldPolicyName, policyName: reportProp.policyName, isOptimisticReport: reportProp.isOptimisticReport, + lastMentionedTime: reportProp.lastMentionedTime, }), [ reportProp.lastReadTime, @@ -242,6 +243,7 @@ function ReportScreen({ reportProp.oldPolicyName, reportProp.policyName, reportProp.isOptimisticReport, + reportProp.lastMentionedTime, ], );