Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One-expense-report old chat messages stays in chat #44529

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,14 @@ function shouldIgnoreGap(currentReportAction: ReportAction | undefined, nextRepo
);
}

/**
* Returns filtered list for one transaction view as we don't want to display IOU action type in the one-transaction view
* Separated it from getCombinedReportActions, so it can be reused
*/
function getFilteredForOneTransactionView(reportActions: ReportAction[]): ReportAction[] {
return reportActions.filter((action) => !isSentMoneyReportAction(action));
}
Comment on lines +380 to +382
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused an issue where paid system message was not showing #45203


/**
* Returns a sorted and filtered list of report actions from a report and it's associated child
* transaction thread report in order to correctly display reportActions from both reports in the one-transaction report view.
Expand Down Expand Up @@ -1462,6 +1470,7 @@ export {
getTextFromHtml,
isTripPreview,
getIOUActionForReportID,
getFilteredForOneTransactionView,
};

export type {LastVisibleMessage};
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItemContentCreated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function ReportActionItemContentCreated({contextValue, parentReportAction, trans
<OfflineWithFeedback pendingAction={action.pendingAction}>
{transactionThreadReport && !isEmptyObject(transactionThreadReport) ? (
<>
{transactionCurrency !== report.currency && (
{!!transaction && transactionCurrency !== report.currency && (
<>
<MoneyReportView
report={report}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/home/report/ReportActionsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ function ReportActionsView({
createdAction.pendingAction = CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE;
}

return [...actions, createdAction];
// moneyRequestActions.length === 1 indicates that we have one-transaction report and we don't want to display additonal IOU action
return moneyRequestActions.length === 1 ? ReportActionsUtils.getFilteredForOneTransactionView([...actions, createdAction]) : [...actions, createdAction];
Copy link
Contributor

@mkhutornyi mkhutornyi Jul 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: Please add comment what moneyRequestActions.length === 1 means

}, [allReportActions, report, transactionThreadReport]);

// Get a sorted array of reportActions for both the current report and the transaction thread report associated with this report (if there is one)
Expand Down
Loading