From 9e365370168987cc6877b35a5791757f17a0ceaa Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Mon, 25 Nov 2024 16:54:42 +0300 Subject: [PATCH] updated hold cases --- src/pages/ReportDetailsPage.tsx | 5 ++++- .../home/report/ContextMenu/BaseReportActionContextMenu.tsx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 37006f5f7b05..cf138535959f 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -636,7 +636,10 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta }, [report, icons, isMoneyRequestReport, isInvoiceReport, isGroupChat, isThread, styles]); const canHoldUnholdReportAction = ReportUtils.canHoldUnholdReportAction(moneyRequestAction); - const shouldShowHoldAction = caseID !== CASES.DEFAULT && (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest); + const shouldShowHoldAction = + caseID !== CASES.DEFAULT && + (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest) && + !ReportUtils.isArchivedNonExpenseReport(transactionThreadReportID ? report : parentReport, parentReportNameValuePairs); const canJoin = ReportUtils.canJoinChat(report, parentReportAction, policy); const promotedActions = useMemo(() => { diff --git a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx index 38807b44a6c4..e05414c3840d 100755 --- a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx @@ -175,13 +175,16 @@ function BaseReportActionContextMenu({ }, [parentReportAction, isMoneyRequestReport, isInvoiceReport, paginatedReportActions, transactionThreadReport?.parentReportActionID]); const moneyRequestAction = transactionThreadReportID ? requestParentReportAction : parentReportAction; + const [parentReportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${childReport?.parentReportID ?? '-1'}`); + const parentReport = ReportUtils.getReport(childReport?.parentReportID ?? '-1'); const isMoneyRequest = useMemo(() => ReportUtils.isMoneyRequest(childReport), [childReport]); const isTrackExpenseReport = ReportUtils.isTrackExpenseReport(childReport); const isSingleTransactionView = isMoneyRequest || isTrackExpenseReport; const isMoneyRequestOrReport = isMoneyRequestReport || isSingleTransactionView; - const areHoldRequirementsMet = !isInvoiceReport && isMoneyRequestOrReport; + const areHoldRequirementsMet = + !isInvoiceReport && isMoneyRequestOrReport && !ReportUtils.isArchivedNonExpenseReport(transactionThreadReportID ? childReport : parentReport, parentReportNameValuePairs); const shouldEnableArrowNavigation = !isMini && (isVisible || shouldKeepOpen); let filteredContextMenuActions = ContextMenuActions.filter(