Skip to content

Commit

Permalink
Fix issue. Each ancestor references the report and the action belongi…
Browse files Browse the repository at this point in the history
…ng to that report which is parent of its child report.
kmbcook committed May 23, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
kmbcook Kevin Cook
1 parent 8c81ca2 commit 4368266
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
@@ -6322,34 +6322,24 @@ function getAllAncestorReportActions(report: Report | null | undefined): Ancesto
let parentReportID = report.parentReportID;
let parentReportActionID = report.parentReportActionID;

// Store the child of parent report
let currentReport = report;

while (parentReportID) {
const parentReport = getReport(parentReportID);
const parentReportAction = ReportActionsUtils.getReportAction(parentReportID, parentReportActionID ?? '0');

//if (!parentReportAction || ReportActionsUtils.isTransactionThread(parentReportAction) || ReportActionsUtils.isReportPreviewAction(parentReportAction)) {
if (!parentReportAction || ReportActionsUtils.isTransactionThread(parentReportAction)) {
if (!parentReport || !parentReportAction || ReportActionsUtils.isTransactionThread(parentReportAction)) {
break;
}

const isParentReportActionUnread = ReportActionsUtils.isCurrentActionUnread(parentReport ?? {}, parentReportAction);
allAncestors.push({
report: currentReport,
report: parentReport,
reportAction: parentReportAction,
shouldDisplayNewMarker: isParentReportActionUnread,
});

if (!parentReport) {
break;
}

parentReportID = parentReport?.parentReportID;
parentReportActionID = parentReport?.parentReportActionID;
if (!isEmptyObject(parentReport)) {
currentReport = parentReport;
}
}

return allAncestors.reverse();

0 comments on commit 4368266

Please sign in to comment.