Skip to content

Commit

Permalink
updated hold cases
Browse files Browse the repository at this point in the history
  • Loading branch information
FitseTLT committed Nov 25, 2024
1 parent 76b27d1 commit 9e36537
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9e36537

Please sign in to comment.