From 0f9dc42dd54b38ddcc162b9bfaa1e89efc7a665a Mon Sep 17 00:00:00 2001 From: Rayane Djouah <77965000+rayane-djouah@users.noreply.github.com> Date: Mon, 29 Apr 2024 21:51:03 +0100 Subject: [PATCH] Fix bug in getAllAncestorReportActions function: User invited by mentioning from a concierge whisper can't see parent message --- src/libs/ReportUtils.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index b23b6ff89fec..7c5793becc90 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6147,16 +6147,21 @@ function getAllAncestorReportActions(report: Report | null | undefined): Ancesto const parentReport = getReport(parentReportID); const parentReportAction = ReportActionsUtils.getReportAction(parentReportID, parentReportActionID ?? '0'); - if (!parentReportAction || ReportActionsUtils.isTransactionThread(parentReportAction) || !parentReport) { + if (!parentReportAction || ReportActionsUtils.isTransactionThread(parentReportAction)) { break; } - const isParentReportActionUnread = ReportActionsUtils.isCurrentActionUnread(parentReport, parentReportAction); + const isParentReportActionUnread = ReportActionsUtils.isCurrentActionUnread(parentReport ?? {}, parentReportAction); allAncestors.push({ report: currentReport, reportAction: parentReportAction, shouldDisplayNewMarker: isParentReportActionUnread, }); + + if (!parentReport) { + break; + } + parentReportID = parentReport?.parentReportID; parentReportActionID = parentReport?.parentReportActionID; if (!isEmptyObject(parentReport)) { @@ -6186,13 +6191,17 @@ function getAllAncestorReportActionIDs(report: Report | null | undefined, includ const parentReport = getReport(parentReportID); const parentReportAction = ReportActionsUtils.getReportAction(parentReportID, parentReportActionID ?? '0'); - if (!parentReportAction || (!includeTransactionThread && ReportActionsUtils.isTransactionThread(parentReportAction)) || !parentReport) { + if (!parentReportAction || (!includeTransactionThread && ReportActionsUtils.isTransactionThread(parentReportAction))) { break; } allAncestorIDs.reportIDs.push(parentReportID ?? ''); allAncestorIDs.reportActionsIDs.push(parentReportActionID ?? ''); + if (!parentReport) { + break; + } + parentReportID = parentReport?.parentReportID; parentReportActionID = parentReport?.parentReportActionID; }