Skip to content

Commit

Permalink
feat: disable enforced report fields
Browse files Browse the repository at this point in the history
  • Loading branch information
allroundexperts committed Jan 22, 2024
1 parent b542031 commit 0485bec
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 @@ -3132,6 +3132,7 @@ const CONST = {
},

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

export default CONST;
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/MoneyReportView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
8 changes: 8 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4523,6 +4523,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 @@ -4738,6 +4745,7 @@ export {
shouldDisableThread,
doesReportBelongToWorkspace,
getChildReportNotificationPreference,
isReportFieldOfTypeTitle,
};

export type {
Expand Down

0 comments on commit 0485bec

Please sign in to comment.