From d0a59fdb1bcb7213cd1f84a8b76b38c9fcb4d05c Mon Sep 17 00:00:00 2001 From: Someshwar Tripathi Date: Mon, 1 Jul 2024 03:55:50 +0530 Subject: [PATCH 1/2] Remove REPORT_FIELDS beta --- src/components/ReportActionItem/MoneyReportView.tsx | 2 +- src/libs/Permissions.ts | 5 ----- src/libs/ReportUtils.ts | 12 ++---------- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/components/ReportActionItem/MoneyReportView.tsx b/src/components/ReportActionItem/MoneyReportView.tsx index a724fd27f134..736b385c99a0 100644 --- a/src/components/ReportActionItem/MoneyReportView.tsx +++ b/src/components/ReportActionItem/MoneyReportView.tsx @@ -62,7 +62,7 @@ function MoneyReportView({report, policy}: MoneyReportViewProps) { {!ReportUtils.isClosedExpenseReportWithNoExpenses(report) && ( <> - {ReportUtils.reportFieldsEnabled(report) && + {ReportUtils.isPaidGroupPolicyExpenseReport(report) && sortedPolicyReportFields.map((reportField) => { const isTitleField = ReportUtils.isReportFieldOfTypeTitle(reportField); const fieldValue = isTitleField ? report.reportName : reportField.value ?? reportField.defaultValue; diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 79936d498280..ad8503a14d40 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -15,10 +15,6 @@ function canUseDefaultRooms(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.DEFAULT_ROOMS) || canUseAllBetas(betas); } -function canUseReportFields(betas: OnyxEntry): boolean { - return !!betas?.includes(CONST.BETAS.REPORT_FIELDS) || canUseAllBetas(betas); -} - function canUseViolations(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.VIOLATIONS) || canUseAllBetas(betas); } @@ -65,7 +61,6 @@ export default { canUseLinkPreviews, canUseViolations, canUseDupeDetection, - canUseReportFields, canUseP2PDistanceRequests, canUseWorkflowsDelayedSubmission, canUseSpotnanaTravel, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index b17fe7266079..fc32bdbe77c6 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2431,13 +2431,6 @@ function isHoldCreator(transaction: OnyxEntry, reportID: string): b return isActionCreator(holdReportAction); } -/** - * Check if report fields are available to use in a report - */ -function reportFieldsEnabled(report: Report) { - return Permissions.canUseReportFields(allBetas ?? []) && isPaidGroupPolicyExpenseReport(report); -} - /** * Given a report field, check if the field can be edited or not. * For title fields, its considered disabled if `deletable` prop is `true` (https://github.com/Expensify/App/issues/35043#issuecomment-1911275433) @@ -2539,7 +2532,7 @@ function getMoneyRequestReportName(report: OnyxEntry, policy?: OnyxEntry const reportFields = isReportSettled ? report?.fieldList : getReportFieldsByPolicyID(report?.policyID ?? '-1'); const titleReportField = getFormulaTypeReportField(reportFields ?? {}); - if (titleReportField && report?.reportName && reportFieldsEnabled(report)) { + if (titleReportField && report?.reportName && isPaidGroupPolicyExpenseReport(report)) { return report.reportName; } @@ -3946,7 +3939,7 @@ function buildOptimisticExpenseReport(chatReportID: string, policyID: string, pa } const titleReportField = getTitleReportField(getReportFieldsByPolicyID(policyID) ?? {}); - if (!!titleReportField && reportFieldsEnabled(expenseReport)) { + if (!!titleReportField && isPaidGroupPolicyExpenseReport(expenseReport)) { expenseReport.reportName = populateOptimisticReportFormula(titleReportField.defaultValue, expenseReport, policy); } @@ -7286,7 +7279,6 @@ export { navigateBackAfterDeleteTransaction, parseReportRouteParams, parseReportActionHtmlToText, - reportFieldsEnabled, requiresAttentionFromCurrentUser, shouldAutoFocusOnKeyPress, shouldCreateNewMoneyRequestReport, From 35045fc261be0444b7c1a2efeb9733227b5b1da3 Mon Sep 17 00:00:00 2001 From: Someshwar Tripathi Date: Thu, 11 Jul 2024 09:38:16 +0530 Subject: [PATCH 2/2] Remove unused const --- src/CONST.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index 50df9118a74e..e8a8accf110f 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -361,7 +361,6 @@ const CONST = { DEFAULT_ROOMS: 'defaultRooms', VIOLATIONS: 'violations', DUPE_DETECTION: 'dupeDetection', - REPORT_FIELDS: 'reportFields', P2P_DISTANCE_REQUESTS: 'p2pDistanceRequests', WORKFLOWS_DELAYED_SUBMISSION: 'workflowsDelayedSubmission', SPOTNANA_TRAVEL: 'spotnanaTravel',