Skip to content

Commit 28e5e45

Browse files
author
Hayata Suenaga
authored
Merge pull request #44594 from bernhardoj/fix/44586-pay-system-message-doesnt-show-in-lhn
Fix paid system message thread does not show up on LHN
2 parents a2f29e5 + 5b7cf37 commit 28e5e45

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/libs/ReportUtils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,10 +1472,10 @@ function isOneTransactionReport(reportID: string): boolean {
14721472
/**
14731473
* Checks if a report is a transaction thread associated with a report that has only one transaction
14741474
*/
1475-
function isOneTransactionThread(reportID: string, parentReportID: string): boolean {
1475+
function isOneTransactionThread(reportID: string, parentReportID: string, threadParentReportAction: OnyxEntry<ReportAction>): boolean {
14761476
const parentReportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`] ?? ([] as ReportAction[]);
14771477
const transactionThreadReportID = ReportActionsUtils.getOneTransactionThreadReportID(parentReportID, parentReportActions);
1478-
return reportID === transactionThreadReportID;
1478+
return reportID === transactionThreadReportID && !ReportActionsUtils.isSentMoneyReportAction(threadParentReportAction);
14791479
}
14801480

14811481
/**
@@ -5426,6 +5426,8 @@ function shouldReportBeInOptionList({
54265426
// This can also happen for anyone accessing a public room or archived room for which they don't have access to the underlying policy.
54275427
// Optionally exclude reports that do not belong to currently active workspace
54285428

5429+
const parentReportAction = ReportActionsUtils.getParentReportAction(report);
5430+
54295431
if (
54305432
!report?.reportID ||
54315433
!report?.type ||
@@ -5456,7 +5458,7 @@ function shouldReportBeInOptionList({
54565458
}
54575459

54585460
// If this is a transaction thread associated with a report that only has one transaction, omit it
5459-
if (isOneTransactionThread(report.reportID, report.parentReportID ?? '-1')) {
5461+
if (isOneTransactionThread(report.reportID, report.parentReportID ?? '-1', parentReportAction)) {
54605462
return false;
54615463
}
54625464

@@ -5529,8 +5531,6 @@ function shouldReportBeInOptionList({
55295531
return false;
55305532
}
55315533

5532-
const parentReportAction = ReportActionsUtils.getParentReportAction(report);
5533-
55345534
// Hide chat threads where the parent message is pending removal
55355535
if (
55365536
!isEmptyObject(parentReportAction) &&

src/libs/SidebarUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,14 @@ function getOrderedReportIDs(
8989
return;
9090
}
9191
const reportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`] ?? {};
92+
const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '-1', report?.parentReportActionID ?? '-1');
9293
const doesReportHaveViolations = OptionsListUtils.shouldShowViolations(report, betas ?? [], transactionViolations);
9394
const isHidden = report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;
9495
const isFocused = report.reportID === currentReportId;
9596
const allReportErrors = OptionsListUtils.getAllReportErrors(report, reportActions) ?? {};
9697
const hasErrorsOtherThanFailedReceipt =
9798
doesReportHaveViolations || Object.values(allReportErrors).some((error) => error?.[0] !== Localize.translateLocal('iou.error.genericSmartscanFailureMessage'));
98-
if (ReportUtils.isOneTransactionThread(report.reportID, report.parentReportID ?? '0')) {
99+
if (ReportUtils.isOneTransactionThread(report.reportID, report.parentReportID ?? '0', parentReportAction)) {
99100
return;
100101
}
101102
if (hasErrorsOtherThanFailedReceipt) {

0 commit comments

Comments
 (0)