Skip to content

Commit

Permalink
Merge pull request #48433 from abzokhattab/fix-system-update-msgs-for…
Browse files Browse the repository at this point in the history
…matting-for-tags
  • Loading branch information
francoisl authored Sep 16, 2024
2 parents 7139a40 + 56a2740 commit d54cbf8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,20 @@ function isTaskAction(reportAction: OnyxEntry<ReportAction>): 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<ValueOf<typeof CONST.IOU.REPORT_ACTION_TYPE>>([
CONST.IOU.REPORT_ACTION_TYPE.CREATE,
Expand Down Expand Up @@ -1801,6 +1815,7 @@ export {
isApprovedAction,
isForwardedAction,
isWhisperActionTargetedToOthers,
isTagModificationAction,
shouldHideNewMarker,
shouldReportActionBeVisible,
shouldReportActionBeVisibleAsLastAction,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ function ReportActionItem({
children = <ReportActionItemBasicMessage message={translate('systemMessage.mergedWithCashTransaction')} />;
} else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.DISMISSED_VIOLATION)) {
children = <ReportActionItemBasicMessage message={ReportActionsUtils.getDismissedViolationMessageText(ReportActionsUtils.getOriginalMessage(action))} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_TAG) {
} else if (ReportActionsUtils.isTagModificationAction(action.actionName)) {
children = <ReportActionItemBasicMessage message={PolicyUtils.getCleanedTagName(ReportActionsUtils.getReportActionMessage(action)?.text ?? '')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME) {
children = <ReportActionItemBasicMessage message={ReportUtils.getWorkspaceNameUpdatedMessage(action)} />;
Expand Down

0 comments on commit d54cbf8

Please sign in to comment.