From 00f066508cae5a1f67b588bc124d5e821aae2f1b Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 2 Jul 2024 13:01:29 +0800 Subject: [PATCH 1/3] show delete expense for self dm track expense --- src/pages/ReportDetailsPage.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index dcbad36d1eda..568703110fd0 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -119,12 +119,14 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD const isInvoiceReport = useMemo(() => ReportUtils.isInvoiceReport(report), [report]); const isInvoiceRoom = useMemo(() => ReportUtils.isInvoiceRoom(report), [report]); const isTaskReport = useMemo(() => ReportUtils.isTaskReport(report), [report]); + const isTrackExpenseReport = ReportUtils.isTrackExpenseReport(report); const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '', report?.parentReportActionID ?? ''); const isCanceledTaskReport = ReportUtils.isCanceledTaskReport(report, parentReportAction); const canEditReportDescription = useMemo(() => ReportUtils.canEditReportDescription(report, policy), [report, policy]); const shouldShowReportDescription = isChatRoom && (canEditReportDescription || report.description !== ''); const isExpenseReport = isMoneyRequestReport || isInvoiceReport || isMoneyRequest; const isSingleTransactionView = isMoneyRequest || ReportUtils.isTrackExpenseReport(report); + const isSelfDMTrackExpenseReport = isTrackExpenseReport && ReportUtils.isSelfDM(parentReport); const shouldDisableRename = useMemo(() => ReportUtils.shouldDisableRename(report), [report]); const parentNavigationSubtitleData = ReportUtils.getParentNavigationSubtitle(report); @@ -190,8 +192,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD report.stateNum !== CONST.REPORT.STATE_NUM.APPROVED && !ReportUtils.isClosedReport(report) && canModifyTask; - const canDeleteRequest = - isActionOwner && (ReportUtils.canAddOrDeleteTransactions(moneyRequestReport) || ReportUtils.isTrackExpenseReport(transactionThreadReport)) && !isDeletedParentAction; + const canDeleteRequest = isActionOwner && (ReportUtils.canAddOrDeleteTransactions(moneyRequestReport) || isSelfDMTrackExpenseReport) && !isDeletedParentAction; const shouldShowDeleteButton = shouldShowTaskDeleteButton || canDeleteRequest; useEffect(() => { From 433dfee4efa619a08fcca033ca184692f9c072e2 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 2 Jul 2024 13:03:24 +0800 Subject: [PATCH 2/3] cleaning up --- src/pages/ReportDetailsPage.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 568703110fd0..7228fbf8724f 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -119,14 +119,14 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD const isInvoiceReport = useMemo(() => ReportUtils.isInvoiceReport(report), [report]); const isInvoiceRoom = useMemo(() => ReportUtils.isInvoiceRoom(report), [report]); const isTaskReport = useMemo(() => ReportUtils.isTaskReport(report), [report]); + const isSelfDM = useMemo(() => ReportUtils.isSelfDM(report), [report]); const isTrackExpenseReport = ReportUtils.isTrackExpenseReport(report); const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '', report?.parentReportActionID ?? ''); const isCanceledTaskReport = ReportUtils.isCanceledTaskReport(report, parentReportAction); const canEditReportDescription = useMemo(() => ReportUtils.canEditReportDescription(report, policy), [report, policy]); const shouldShowReportDescription = isChatRoom && (canEditReportDescription || report.description !== ''); const isExpenseReport = isMoneyRequestReport || isInvoiceReport || isMoneyRequest; - const isSingleTransactionView = isMoneyRequest || ReportUtils.isTrackExpenseReport(report); - const isSelfDMTrackExpenseReport = isTrackExpenseReport && ReportUtils.isSelfDM(parentReport); + const isSingleTransactionView = isMoneyRequest || isTrackExpenseReport; const shouldDisableRename = useMemo(() => ReportUtils.shouldDisableRename(report), [report]); const parentNavigationSubtitleData = ReportUtils.getParentNavigationSubtitle(report); @@ -160,8 +160,6 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD }, [isInvoiceReport, isMoneyRequestReport, isSingleTransactionView]); const isPrivateNotesFetchTriggered = report?.isLoadingPrivateNotes !== undefined; - const isSelfDM = useMemo(() => ReportUtils.isSelfDM(report), [report]); - const requestParentReportAction = useMemo(() => { // 2. MoneyReport case if (caseID === CASES.MONEY_REPORT) { From 1902101a402716f7b019f25f5fcdc939f92a2119 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 2 Jul 2024 13:06:13 +0800 Subject: [PATCH 3/3] add missing code --- src/pages/ReportDetailsPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 7228fbf8724f..b04e56f288e9 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -127,6 +127,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD const shouldShowReportDescription = isChatRoom && (canEditReportDescription || report.description !== ''); const isExpenseReport = isMoneyRequestReport || isInvoiceReport || isMoneyRequest; const isSingleTransactionView = isMoneyRequest || isTrackExpenseReport; + const isSelfDMTrackExpenseReport = isTrackExpenseReport && ReportUtils.isSelfDM(parentReport); const shouldDisableRename = useMemo(() => ReportUtils.shouldDisableRename(report), [report]); const parentNavigationSubtitleData = ReportUtils.getParentNavigationSubtitle(report);