From 3b89cae88af31d5b3c70fb3ba82e46b7f6976ec4 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Mon, 27 Mar 2023 16:44:15 +0000 Subject: [PATCH] simplify logic and add specific consts --- src/CONST.js | 4 +++- src/libs/ReportActionsUtils.js | 7 +------ src/pages/home/report/ReportActionItem.js | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/CONST.js b/src/CONST.js index 84f7ef267863..4b746056aff8 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -337,7 +337,9 @@ const CONST = { IOU: 'IOU', RENAMED: 'RENAMED', CHRONOSOOOLIST: 'CHRONOSOOOLIST', - POLICYCHANGELOG: 'POLICYCHANGELOG_', + POLICYCHANGELOG: { + POLICYCHANGELOG_UPDATE_FIELD: 'POLICYCHANGELOG_UPDATE_FIELD', + }, }, }, ARCHIVE_REASON: { diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js index ad937855b4ba..95947277f759 100644 --- a/src/libs/ReportActionsUtils.js +++ b/src/libs/ReportActionsUtils.js @@ -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; } diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 86bc7caee15f..acff50c9e650 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -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, ]} /> ) : (