diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 8d61ad864409..1a6d33aa9f7f 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -971,6 +971,20 @@ function isTaskAction(reportAction: OnyxEntry): boolean { ); } +/** + * @param actionName - The name of the action + * @returns - Whether the action is a tag modification action + * */ +function isTagModificationAction(actionName: string): boolean { + return ( + actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_TAG || + actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_ENABLED || + actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_NAME || + actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_TAG || + actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG + ); +} + // Get all IOU report actions for the report. const iouRequestTypes = new Set>([ CONST.IOU.REPORT_ACTION_TYPE.CREATE, @@ -1801,6 +1815,7 @@ export { isApprovedAction, isForwardedAction, isWhisperActionTargetedToOthers, + isTagModificationAction, shouldHideNewMarker, shouldReportActionBeVisible, shouldReportActionBeVisibleAsLastAction, diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index f2e97607a05c..0908892dc376 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -436,7 +436,7 @@ function getOptionData({ result.alternateText = ReportActionsUtils.getCardIssuedMessage(lastAction); } else if (lastAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && lastActorDisplayName && lastMessageTextFromReport) { result.alternateText = ReportUtils.formatReportLastMessageText(Parser.htmlToText(`${lastActorDisplayName}: ${lastMessageText}`)); - } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_TAG) { + } else if (ReportActionsUtils.isTagModificationAction(lastAction?.actionName)) { result.alternateText = PolicyUtils.getCleanedTagName(ReportActionsUtils.getReportActionMessage(lastAction)?.text ?? ''); } else if (lastAction && ReportActionsUtils.isOldDotReportAction(lastAction)) { result.alternateText = ReportActionsUtils.getMessageOfOldDotReportAction(lastAction); diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 8ea9a3c6aa40..8b83b3f00ce1 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -655,7 +655,7 @@ function ReportActionItem({ children = ; } else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.DISMISSED_VIOLATION)) { children = ; - } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_TAG) { + } else if (ReportActionsUtils.isTagModificationAction(action.actionName)) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME) { children = ;