From da79ed97e299614a7540581a4cff69863b5a25de Mon Sep 17 00:00:00 2001 From: Roji Philip Date: Tue, 10 Oct 2023 11:26:54 +0530 Subject: [PATCH 1/7] Exclude reports in LHN that has no report type --- src/libs/ReportUtils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 591656b5c06a..5d751e84f873 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -3027,6 +3027,7 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, betas, if ( !report || !report.reportID || + !report.type || report.isHidden || (report.participantAccountIDs && report.participantAccountIDs.length === 0 && From 65a28eadb0a8da3e96845bb7e75868736aa3d35b Mon Sep 17 00:00:00 2001 From: Roji Philip Date: Tue, 10 Oct 2023 11:28:26 +0530 Subject: [PATCH 2/7] prettier fix --- src/libs/ReportUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 5d751e84f873..f9cd78f73d54 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -3027,7 +3027,7 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, betas, if ( !report || !report.reportID || - !report.type || + !report.type || report.isHidden || (report.participantAccountIDs && report.participantAccountIDs.length === 0 && From 81d8632e6542f53495c1767e803b2e34fa4c1b6d Mon Sep 17 00:00:00 2001 From: Roji Philip Date: Tue, 10 Oct 2023 13:19:37 +0530 Subject: [PATCH 3/7] jest unit test failure fix --- src/libs/ReportUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index f9cd78f73d54..379b6812ad19 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -3027,8 +3027,8 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, betas, if ( !report || !report.reportID || - !report.type || report.isHidden || + !report.participantAccountIDs || (report.participantAccountIDs && report.participantAccountIDs.length === 0 && !isChatThread(report) && From 297e0201d1c45311fb5058c7e0a445b00445df45 Mon Sep 17 00:00:00 2001 From: Roji Philip Date: Wed, 11 Oct 2023 11:05:33 +0530 Subject: [PATCH 4/7] participantAccountIDs for optimistic expense reprt --- src/libs/ReportUtils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 379b6812ad19..87ab27919f54 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2167,6 +2167,7 @@ function buildOptimisticExpenseReport(chatReportID, policyID, payeeAccountID, to total: storedTotal, notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, parentReportID: chatReportID, + participantAccountIDs: [], }; } From db6e1377d556aee91493d87209824be97d6d7b51 Mon Sep 17 00:00:00 2001 From: Roji Philip Date: Thu, 12 Oct 2023 10:14:05 +0530 Subject: [PATCH 5/7] Revert "participantAccountIDs for optimistic expense reprt" This reverts commit 297e0201d1c45311fb5058c7e0a445b00445df45. --- src/libs/ReportUtils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 87ab27919f54..379b6812ad19 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2167,7 +2167,6 @@ function buildOptimisticExpenseReport(chatReportID, policyID, payeeAccountID, to total: storedTotal, notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, parentReportID: chatReportID, - participantAccountIDs: [], }; } From 0cd1d40f51247af7f47ca7b571e3e526004bc077 Mon Sep 17 00:00:00 2001 From: Roji Philip Date: Thu, 12 Oct 2023 10:16:01 +0530 Subject: [PATCH 6/7] Revert "jest unit test failure fix" This reverts commit 81d8632e6542f53495c1767e803b2e34fa4c1b6d. --- src/libs/ReportUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 379b6812ad19..f9cd78f73d54 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -3027,8 +3027,8 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, betas, if ( !report || !report.reportID || + !report.type || report.isHidden || - !report.participantAccountIDs || (report.participantAccountIDs && report.participantAccountIDs.length === 0 && !isChatThread(report) && From e984d2785cd350e31cb4aaad9444e030551fe969 Mon Sep 17 00:00:00 2001 From: Roji Philip Date: Thu, 12 Oct 2023 10:50:32 +0530 Subject: [PATCH 7/7] fix failing unit tests --- tests/ui/UnreadIndicatorsTest.js | 1 + tests/unit/OptionsListUtilsTest.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/tests/ui/UnreadIndicatorsTest.js b/tests/ui/UnreadIndicatorsTest.js index 361eb8f87081..a9ffe258ac7f 100644 --- a/tests/ui/UnreadIndicatorsTest.js +++ b/tests/ui/UnreadIndicatorsTest.js @@ -309,6 +309,7 @@ describe('Unread Indicators', () => { lastVisibleActionCreated: DateUtils.getDBTime(utcToZonedTime(NEW_REPORT_FIST_MESSAGE_CREATED_DATE, 'UTC').valueOf()), lastMessageText: 'Comment 1', participantAccountIDs: [USER_C_ACCOUNT_ID], + type: CONST.REPORT.TYPE.CHAT, }, }, { diff --git a/tests/unit/OptionsListUtilsTest.js b/tests/unit/OptionsListUtilsTest.js index 437d37e625dd..eda743f85aa2 100644 --- a/tests/unit/OptionsListUtilsTest.js +++ b/tests/unit/OptionsListUtilsTest.js @@ -18,6 +18,7 @@ describe('OptionsListUtils', () => { participantAccountIDs: [2, 1], reportName: 'Iron Man, Mister Fantastic', hasDraft: true, + type: CONST.REPORT.TYPE.CHAT, }, 2: { lastReadTime: '2021-01-14 11:25:39.296', @@ -26,6 +27,7 @@ describe('OptionsListUtils', () => { reportID: 2, participantAccountIDs: [3], reportName: 'Spider-Man', + type: CONST.REPORT.TYPE.CHAT, }, // This is the only report we are pinning in this test @@ -36,6 +38,7 @@ describe('OptionsListUtils', () => { reportID: 3, participantAccountIDs: [1], reportName: 'Mister Fantastic', + type: CONST.REPORT.TYPE.CHAT, }, 4: { lastReadTime: '2021-01-14 11:25:39.298', @@ -44,6 +47,7 @@ describe('OptionsListUtils', () => { reportID: 4, participantAccountIDs: [4], reportName: 'Black Panther', + type: CONST.REPORT.TYPE.CHAT, }, 5: { lastReadTime: '2021-01-14 11:25:39.299', @@ -52,6 +56,7 @@ describe('OptionsListUtils', () => { reportID: 5, participantAccountIDs: [5], reportName: 'Invisible Woman', + type: CONST.REPORT.TYPE.CHAT, }, 6: { lastReadTime: '2021-01-14 11:25:39.300', @@ -60,6 +65,7 @@ describe('OptionsListUtils', () => { reportID: 6, participantAccountIDs: [6], reportName: 'Thor', + type: CONST.REPORT.TYPE.CHAT, }, // Note: This report has the largest lastVisibleActionCreated @@ -70,6 +76,7 @@ describe('OptionsListUtils', () => { reportID: 7, participantAccountIDs: [7], reportName: 'Captain America', + type: CONST.REPORT.TYPE.CHAT, }, // Note: This report has no lastVisibleActionCreated @@ -80,6 +87,7 @@ describe('OptionsListUtils', () => { reportID: 8, participantAccountIDs: [12], reportName: 'Silver Surfer', + type: CONST.REPORT.TYPE.CHAT, }, // Note: This report has an IOU @@ -92,6 +100,7 @@ describe('OptionsListUtils', () => { reportName: 'Mister Sinister', iouReportID: 100, hasOutstandingIOU: true, + type: CONST.REPORT.TYPE.CHAT, }, // This report is an archived room – it does not have a name and instead falls back on oldPolicyName @@ -105,6 +114,7 @@ describe('OptionsListUtils', () => { oldPolicyName: "SHIELD's workspace", chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT, isOwnPolicyExpenseChat: true, + type: CONST.REPORT.TYPE.CHAT, // This indicates that the report is archived stateNum: 2, @@ -179,6 +189,7 @@ describe('OptionsListUtils', () => { reportID: 11, participantAccountIDs: [999], reportName: 'Concierge', + type: CONST.REPORT.TYPE.CHAT, }, }; @@ -191,6 +202,7 @@ describe('OptionsListUtils', () => { reportID: 12, participantAccountIDs: [1000], reportName: 'Chronos', + type: CONST.REPORT.TYPE.CHAT, }, }; @@ -203,6 +215,7 @@ describe('OptionsListUtils', () => { reportID: 13, participantAccountIDs: [1001], reportName: 'Receipts', + type: CONST.REPORT.TYPE.CHAT, }, }; @@ -219,6 +232,7 @@ describe('OptionsListUtils', () => { isArchivedRoom: false, chatType: CONST.REPORT.CHAT_TYPE.POLICY_ADMINS, isOwnPolicyExpenseChat: true, + type: CONST.REPORT.TYPE.CHAT, }, };