From 72c999e43e148148075f0d9020746b703ebc54f1 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 21 Jul 2023 15:41:57 +0800 Subject: [PATCH 1/2] filter out task, money request, chat room, and policy expense report --- src/libs/ReportUtils.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 764699947a97..684f21dcc462 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2183,7 +2183,7 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, iouRep } /** - * Attempts to find a report in onyx with the provided list of participants. Does not include threads + * Attempts to find a report in onyx with the provided list of participants. Does not include threads, task, moneye request, room, and policy expense chat. * @param {Array} newParticipantList * @returns {Array|undefined} */ @@ -2191,12 +2191,20 @@ function getChatByParticipants(newParticipantList) { newParticipantList.sort(); return _.find(allReports, (report) => { // If the report has been deleted, or there are no participants (like an empty #admins room) then skip it - if (!report || _.isEmpty(report.participantAccountIDs) || isChatThread(report)) { + if ( + !report || + _.isEmpty(report.participantAccountIDs) || + isChatThread(report) || + isTaskReport(report) || + isMoneyRequestReport(report) || + isChatRoom(report) || + isPolicyExpenseChat(report) + ) { return false; } - // Only return the room if it has all the participants and is not a policy room - return !isUserCreatedPolicyRoom(report) && _.isEqual(newParticipantList, _.sortBy(report.participantAccountIDs)); + // Only return the chat if it has all the participants + return _.isEqual(newParticipantList, _.sortBy(report.participantAccountIDs)); }); } From 07835093bc6cc2c4224ef351ce953666db3e52e5 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 21 Jul 2023 16:07:27 +0800 Subject: [PATCH 2/2] fix typo --- 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 684f21dcc462..d531c91df237 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2183,7 +2183,7 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, iouRep } /** - * Attempts to find a report in onyx with the provided list of participants. Does not include threads, task, moneye request, room, and policy expense chat. + * Attempts to find a report in onyx with the provided list of participants. Does not include threads, task, money request, room, and policy expense chat. * @param {Array} newParticipantList * @returns {Array|undefined} */