From f41e297921cdbb1283d43ba638a22695d8989763 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Mon, 24 Jun 2024 12:47:06 +0200 Subject: [PATCH 1/3] correct hold action conditional to enable only after scanning --- src/pages/ReportDetailsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index f693c10c69f1..b64c6f2a668f 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -444,8 +444,8 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD const isSettled = ReportUtils.isSettled(moneyRequestReport?.reportID); const isApproved = ReportUtils.isReportApproved(moneyRequestReport); - const shouldShowHoldAction = caseID !== CASES.MONEY_REPORT && !isSettled && !isApproved && !isDeletedParentAction && !ReportUtils.isArchivedRoom(parentReport); const canHoldUnholdReportAction = ReportUtils.canHoldUnholdReportAction(parentReportAction); + const shouldShowHoldAction = caseID !== CASES.MONEY_REPORT && (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest) && !isSettled && !isApproved && !isDeletedParentAction && !ReportUtils.isArchivedRoom(parentReport); const canJoin = !isExpenseReport && ReportUtils.canJoinChat(report, parentReportAction, policy); From c5d8cbb613ce2878ab37e9e200197be14130211b Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Mon, 24 Jun 2024 12:48:22 +0200 Subject: [PATCH 2/3] fix prettier --- src/pages/ReportDetailsPage.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index b64c6f2a668f..b2731ee88855 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -445,7 +445,13 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD const isApproved = ReportUtils.isReportApproved(moneyRequestReport); const canHoldUnholdReportAction = ReportUtils.canHoldUnholdReportAction(parentReportAction); - const shouldShowHoldAction = caseID !== CASES.MONEY_REPORT && (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest) && !isSettled && !isApproved && !isDeletedParentAction && !ReportUtils.isArchivedRoom(parentReport); + const shouldShowHoldAction = + caseID !== CASES.MONEY_REPORT && + (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest) && + !isSettled && + !isApproved && + !isDeletedParentAction && + !ReportUtils.isArchivedRoom(parentReport); const canJoin = !isExpenseReport && ReportUtils.canJoinChat(report, parentReportAction, policy); From 080b27ae9f506a5767a1bed2da1b35937c52055e Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Mon, 24 Jun 2024 13:53:11 +0200 Subject: [PATCH 3/3] refactor conditional and remove obsolete code --- src/pages/ReportDetailsPage.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index b2731ee88855..ca28cae3dfff 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -441,17 +441,9 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD ? ReportActionsUtils.getOriginalMessage(requestParentReportAction)?.IOUTransactionID ?? '' : ''; - const isSettled = ReportUtils.isSettled(moneyRequestReport?.reportID); - const isApproved = ReportUtils.isReportApproved(moneyRequestReport); - const canHoldUnholdReportAction = ReportUtils.canHoldUnholdReportAction(parentReportAction); const shouldShowHoldAction = - caseID !== CASES.MONEY_REPORT && - (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest) && - !isSettled && - !isApproved && - !isDeletedParentAction && - !ReportUtils.isArchivedRoom(parentReport); + caseID !== CASES.MONEY_REPORT && (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest) && !ReportUtils.isArchivedRoom(parentReport); const canJoin = !isExpenseReport && ReportUtils.canJoinChat(report, parentReportAction, policy);