Skip to content

Commit

Permalink
Merge pull request #34884 from allroundexperts/fix-34865
Browse files Browse the repository at this point in the history
feat: disable enforced report fields
  • Loading branch information
thienlnam authored Jan 23, 2024
2 parents 332a876 + 0485bec commit c060897
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3131,6 +3131,7 @@ const CONST = {
},

MINI_CONTEXT_MENU_MAX_ITEMS: 4,
REPORT_FIELD_TITLE_FIELD_ID: 'text_title',
} as const;

type Country = keyof typeof CONST.ALL_COUNTRIES;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/MoneyReportView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function MoneyReportView({report, policyReportFields, shouldShowHorizontalRule}:
title={title}
onPress={() => Navigation.navigate(ROUTES.EDIT_REPORT_FIELD_REQUEST.getRoute(report.reportID, report.policyID ?? '', reportField.fieldID))}
shouldShowRightIcon
disabled={false}
disabled={ReportUtils.isReportFieldOfTypeTitle(reportField)}
wrapperStyle={[styles.pv2, styles.taskDescriptionMenuItem]}
shouldGreyOutWhenDisabled={false}
numberOfLinesTitle={0}
Expand Down
8 changes: 8 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4525,6 +4525,13 @@ function getReportFieldTitle(report: OnyxEntry<Report>, 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
*/
Expand Down Expand Up @@ -4740,6 +4747,7 @@ export {
shouldDisableThread,
doesReportBelongToWorkspace,
getChildReportNotificationPreference,
isReportFieldOfTypeTitle,
};

export type {
Expand Down

0 comments on commit c060897

Please sign in to comment.