Skip to content

Commit

Permalink
Fix bug in getAllAncestorReportActions function: User invited by ment…
Browse files Browse the repository at this point in the history
…ioning from a concierge whisper can't see parent message
  • Loading branch information
rayane-djouah committed Apr 29, 2024
1 parent 3d06f77 commit 0f9dc42
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 0f9dc42

Please sign in to comment.