From 0485bec3de34af979849d50b591773c71eb52285 Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Mon, 22 Jan 2024 18:25:06 +0500 Subject: [PATCH] feat: disable enforced report fields --- src/CONST.ts | 1 + src/components/ReportActionItem/MoneyReportView.tsx | 2 +- src/libs/ReportUtils.ts | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index 0b10e5767328..b4a88b774998 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -3132,6 +3132,7 @@ const CONST = { }, MINI_CONTEXT_MENU_MAX_ITEMS: 4, + REPORT_FIELD_TITLE_FIELD_ID: 'text_title', } as const; export default CONST; diff --git a/src/components/ReportActionItem/MoneyReportView.tsx b/src/components/ReportActionItem/MoneyReportView.tsx index 4fcca3e518a5..68b725c3458e 100644 --- a/src/components/ReportActionItem/MoneyReportView.tsx +++ b/src/components/ReportActionItem/MoneyReportView.tsx @@ -75,7 +75,7 @@ function MoneyReportView({report, policyReportFields, shouldShowHorizontalRule}: title={title} onPress={() => {}} shouldShowRightIcon - disabled={false} + disabled={ReportUtils.isReportFieldOfTypeTitle(reportField)} wrapperStyle={[styles.pv2, styles.taskDescriptionMenuItem]} shouldGreyOutWhenDisabled={false} numberOfLinesTitle={0} diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 8e78dead4a93..8d95de2d7d12 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4523,6 +4523,13 @@ function getReportFieldTitle(report: OnyxEntry, reportField: PolicyRepor }); } +/** + * Given a report field, check if the field is for the report title. + */ +function isReportFieldOfTypeTitle(reportField: PolicyReportField): boolean { + return reportField.type === 'formula' && reportField.fieldID === CONST.REPORT_FIELD_TITLE_FIELD_ID; +} + /** * Checks if thread replies should be displayed */ @@ -4738,6 +4745,7 @@ export { shouldDisableThread, doesReportBelongToWorkspace, getChildReportNotificationPreference, + isReportFieldOfTypeTitle, }; export type {