Skip to content

Commit

Permalink
simplify logic and add specific consts
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed Mar 27, 2023
1 parent 55d155f commit 3b89cae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ const CONST = {
IOU: 'IOU',
RENAMED: 'RENAMED',
CHRONOSOOOLIST: 'CHRONOSOOOLIST',
POLICYCHANGELOG: 'POLICYCHANGELOG_',
POLICYCHANGELOG: {
POLICYCHANGELOG_UPDATE_FIELD: 'POLICYCHANGELOG_UPDATE_FIELD',
},
},
},
ARCHIVE_REASON: {
Expand Down
7 changes: 1 addition & 6 deletions src/libs/ReportActionsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,8 @@ function getSortedReportActionsForDisplay(reportActions) {
const filteredReportActions = filterOutDeprecatedReportActions(reportActions);
const sortedReportActions = getSortedReportActions(filteredReportActions, true);
return _.filter(sortedReportActions, (reportAction) => {
// Allow all Policy Change reportActions to be displayed
if (reportAction.actionName && reportAction.actionName.startsWith(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG)) {
return true;
}

// Filter out any unsupported reportAction types
if (!_.has(CONST.REPORT.ACTIONS.TYPE, reportAction.actionName)) {
if (!_.has(CONST.REPORT.ACTIONS.TYPE, reportAction.actionName) && !_.has(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG, reportAction.actionName)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class ReportActionItem extends Component {
action={this.props.action}
style={[
(!this.props.displayAsGroup && isAttachment) ? styles.mt2 : undefined,
(this.props.action.actionName && this.props.action.actionName.startsWith(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG)) ? styles.colorMuted : undefined,
_.has(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG, this.props.action.actionName) ? styles.colorMuted : undefined,
]}
/>
) : (
Expand Down

0 comments on commit 3b89cae

Please sign in to comment.