From 1d67d2dae680e03514af6c02d00b149ba8e5f85e Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Wed, 17 Jan 2024 18:10:04 +0100 Subject: [PATCH] Fix displaying Concierge chat report --- src/libs/ReportUtils.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 3720ff375490..c606a4c09eda 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -639,11 +639,21 @@ function hasReportCommonPolicyMemberWithArray(report: Report, policyMembersAccou return false; } +/** + * Only returns true if this is our main 1:1 DM report with Concierge + */ +function isConciergeChatReport(report: OnyxEntry): boolean { + return report?.participantAccountIDs?.length === 1 && Number(report.participantAccountIDs?.[0]) === CONST.ACCOUNT_ID.CONCIERGE && !isChatThread(report); +} + /** * Checks if the supplied report belongs to workspace based on the provided params. */ function doesReportBelongToWorkspace(report: Report, policyID: string, policyMembersAccountIDs: string[]) { - return report.policyID === CONST.POLICY.ID_FAKE || !report.policyID ? hasReportCommonPolicyMemberWithArray(report, policyMembersAccountIDs) : report.policyID === policyID; + return ( + isConciergeChatReport(report) || + (report.policyID === CONST.POLICY.ID_FAKE || !report.policyID ? hasReportCommonPolicyMemberWithArray(report, policyMembersAccountIDs) : report.policyID === policyID) + ); } /** @@ -860,13 +870,6 @@ function isDM(report: OnyxEntry): boolean { return isChatReport(report) && !getChatType(report); } -/** - * Only returns true if this is our main 1:1 DM report with Concierge - */ -function isConciergeChatReport(report: OnyxEntry): boolean { - return report?.participantAccountIDs?.length === 1 && Number(report.participantAccountIDs?.[0]) === CONST.ACCOUNT_ID.CONCIERGE && !isChatThread(report); -} - /** * Returns true if report is still being processed */