From 1ff55cb921cec763cc5970664344923bbfe9a682 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Mon, 24 Jun 2024 19:43:04 +0800 Subject: [PATCH 1/2] hide join button in track expense report --- src/libs/ReportUtils.ts | 3 ++- src/pages/ReportDetailsPage.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index a2cb56510f12..d4328c9ef683 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6843,8 +6843,9 @@ function canJoinChat(report: OnyxInputOrEntry, parentReportAction: OnyxI return false; } + const isExpenseReport = isMoneyRequestReport(report) || isMoneyRequest(report) || isInvoiceReport(report) || isTrackExpenseReport(report); // Anyone viewing these chat types is already a participant and therefore cannot join - if (isRootGroupChat(report) || isSelfDM(report) || isInvoiceRoom(report) || isSystemChat(report)) { + if (isRootGroupChat(report) || isSelfDM(report) || isInvoiceRoom(report) || isSystemChat(report) || isExpenseReport) { return false; } diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index f693c10c69f1..04e951ef85e5 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -447,7 +447,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD const shouldShowHoldAction = caseID !== CASES.MONEY_REPORT && !isSettled && !isApproved && !isDeletedParentAction && !ReportUtils.isArchivedRoom(parentReport); const canHoldUnholdReportAction = ReportUtils.canHoldUnholdReportAction(parentReportAction); - const canJoin = !isExpenseReport && ReportUtils.canJoinChat(report, parentReportAction, policy); + const canJoin = ReportUtils.canJoinChat(report, parentReportAction, policy); const promotedActions = useMemo(() => { const result: PromotedAction[] = []; From 0f0c83c0c79e83eb89dedde1c7944596b842ab88 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Mon, 24 Jun 2024 19:55:55 +0800 Subject: [PATCH 2/2] fix lint --- src/libs/ReportUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index d4328c9ef683..0c4fd9c83faa 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6843,9 +6843,9 @@ function canJoinChat(report: OnyxInputOrEntry, parentReportAction: OnyxI return false; } - const isExpenseReport = isMoneyRequestReport(report) || isMoneyRequest(report) || isInvoiceReport(report) || isTrackExpenseReport(report); + const isExpenseChat = isMoneyRequestReport(report) || isMoneyRequest(report) || isInvoiceReport(report) || isTrackExpenseReport(report); // Anyone viewing these chat types is already a participant and therefore cannot join - if (isRootGroupChat(report) || isSelfDM(report) || isInvoiceRoom(report) || isSystemChat(report) || isExpenseReport) { + if (isRootGroupChat(report) || isSelfDM(report) || isInvoiceRoom(report) || isSystemChat(report) || isExpenseChat) { return false; }