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', diff --git a/src/components/ReportActionItem/MoneyReportView.tsx b/src/components/ReportActionItem/MoneyReportView.tsx index 4bd6d4103bee..d0f35990b507 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) => { if (ReportUtils.isReportFieldOfTypeTitle(reportField)) { return null; diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index faea5965fee4..23aabcf3c6d0 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); } @@ -73,7 +69,6 @@ export default { canUseLinkPreviews, canUseViolations, canUseDupeDetection, - canUseReportFields, canUseP2PDistanceRequests, canUseWorkflowsDelayedSubmission, canUseSpotnanaTravel, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index afe384b87531..50d9a47e85e2 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2478,13 +2478,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) @@ -2586,7 +2579,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; } @@ -3995,7 +3988,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); } @@ -7338,7 +7331,6 @@ export { navigateBackAfterDeleteTransaction, parseReportRouteParams, parseReportActionHtmlToText, - reportFieldsEnabled, requiresAttentionFromCurrentUser, shouldAutoFocusOnKeyPress, shouldCreateNewMoneyRequestReport,