From a4dcc97d577b80ac9e2d6b36ea140e433eea1941 Mon Sep 17 00:00:00 2001 From: Artem Makushov Date: Mon, 11 Dec 2023 19:24:12 +0100 Subject: [PATCH] updated --- src/libs/ReportUtils.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index a2549e76d505..f6fe4ce8c661 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1531,14 +1531,14 @@ function isWaitingForAssigneeToCompleteTask(report: OnyxEntry, parentRep return isTaskReport(report) && isReportManager(report) && isOpenTaskReport(report, parentReportAction); } -function isUnreadWithMention(report: OnyxEntry | OptionData): boolean { - if (!report) { +function isUnreadWithMention(reportOrOption: OnyxEntry | OptionData): boolean { + if (!reportOrOption) { return false; } // lastMentionedTime and lastReadTime are both datetime strings and can be compared directly - const lastMentionedTime = report.lastMentionedTime ?? ''; - const lastReadTime = report.lastReadTime ?? ''; - return Boolean('isUnreadWithMention' in report && report.isUnreadWithMention) || lastReadTime < lastMentionedTime; + const lastMentionedTime = reportOrOption.lastMentionedTime ?? ''; + const lastReadTime = reportOrOption.lastReadTime ?? ''; + return Boolean('isUnreadWithMention' in reportOrOption && reportOrOption.isUnreadWithMention) || lastReadTime < lastMentionedTime; } /** @@ -1550,25 +1550,25 @@ function isUnreadWithMention(report: OnyxEntry | OptionData): boolean { * @param option (report or optionItem) * @param parentReportAction (the report action the current report is a thread of) */ -function requiresAttentionFromCurrentUser(option: OnyxEntry | OptionData, parentReportAction: EmptyObject | OnyxEntry = {}) { - if (!option) { +function requiresAttentionFromCurrentUser(optionOrReport: OnyxEntry | OptionData, parentReportAction: EmptyObject | OnyxEntry = {}) { + if (!optionOrReport) { return false; } - if (isArchivedRoom(option) || isArchivedRoom(getReport(option.parentReportID))) { + if (isArchivedRoom(optionOrReport) || isArchivedRoom(getReport(optionOrReport.parentReportID))) { return false; } - if (isUnreadWithMention(option)) { + if (isUnreadWithMention(optionOrReport)) { return true; } - if (isWaitingForAssigneeToCompleteTask(option, parentReportAction)) { + if (isWaitingForAssigneeToCompleteTask(optionOrReport, parentReportAction)) { return true; } // Has a child report that is awaiting action (e.g. approve, pay, add bank account) from current user - if (option.hasOutstandingChildRequest) { + if (optionOrReport.hasOutstandingChildRequest) { return true; }