diff --git a/src/languages/en.ts b/src/languages/en.ts index 2d501086d026a..88c32b44de377 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -198,6 +198,7 @@ import type { UpdatedCustomFieldParams, UpdatedPolicyApprovalRuleParams, UpdatedPolicyAuditRateParams, + UpdatedPolicyCategoryDescriptionHintTypeParams, UpdatedPolicyCategoryExpenseLimitTypeParams, UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, @@ -5299,6 +5300,15 @@ const translations = { return `changed the "${categoryName}" category to ${newValue} (previously ${oldValue})`; }, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renamed the category "${oldName}" to "${newName}"`, + updatedDescriptionHint: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryDescriptionHintTypeParams) => { + if (!newValue) { + return `removed the description hint "${oldValue}" from the category "${categoryName}"`; + } + + return !oldValue + ? `added the description hint "${newValue}" to the category "${categoryName}"` + : `changed the "${categoryName}" category description hint to “${newValue}” (previously “${oldValue}”)`; + }, updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `changed the tag list name to "${newName}" (previously "${oldName}")`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `added the tag "${tagName}" to the list "${tagListName}"`, updateTagName: ({tagListName, newName, oldName}: UpdatedPolicyTagNameParams) => `updated the tag list "${tagListName}" by changing the tag "${oldName}" to "${newName}`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 4130c41689a4f..e1d43b7742ea2 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -197,6 +197,7 @@ import type { UpdatedCustomFieldParams, UpdatedPolicyApprovalRuleParams, UpdatedPolicyAuditRateParams, + UpdatedPolicyCategoryDescriptionHintTypeParams, UpdatedPolicyCategoryExpenseLimitTypeParams, UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, @@ -5306,6 +5307,15 @@ const translations = { addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `añadió la categoría "${categoryName}""`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `eliminó la categoría "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'deshabilitó' : 'habilitó'} la categoría "${categoryName}"`, + updatedDescriptionHint: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryDescriptionHintTypeParams) => { + if (!newValue) { + return `eliminó la sugerencia de descripción "${oldValue}" de la categoría "${categoryName}"`; + } + + return !oldValue + ? `añadió la sugerencia de descripción "${newValue}" a la categoría "${categoryName}"` + : `cambió la sugerencia de descripción de la categoría "${categoryName}" a “${newValue}” (anteriormente “${oldValue}”)`; + }, updateCategoryPayrollCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { return `añadió el código de nómina "${newValue}" a la categoría "${categoryName}"`; diff --git a/src/languages/params.ts b/src/languages/params.ts index 8096033e2586b..6a9d8e64293e1 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -312,7 +312,9 @@ type UpdatedPolicyDescriptionParams = {oldDescription: string; newDescription: s type UpdatedPolicyCurrencyParams = {oldCurrency: string; newCurrency: string}; -type UpdatedPolicyCategoryParams = {categoryName: string; oldValue?: boolean}; +type UpdatedPolicyCategoryParams = {categoryName: string; oldValue?: boolean | string | number; newValue?: boolean | string | number}; + +type UpdatedPolicyCategoryDescriptionHintTypeParams = {categoryName: string; oldValue?: string; newValue?: string}; type UpdatedPolicyCategoryGLCodeParams = {categoryName: string; oldValue?: string; newValue?: string}; @@ -961,6 +963,7 @@ export type { UpdatedPolicyCurrencyParams, UpdatedPolicyFrequencyParams, UpdatedPolicyCategoryParams, + UpdatedPolicyCategoryDescriptionHintTypeParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyPreventSelfApprovalParams, UpdatedPolicyFieldWithNewAndOldValueParams, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 3407e181370fa..0f8dc95d7767d 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2080,6 +2080,14 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction, policyID?: stri } if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CATEGORY && categoryName) { + if (updatedField === 'commentHint') { + return translateLocal('workspaceActions.updatedDescriptionHint', { + oldValue: oldValue as string | undefined, + newValue: newValue as string | undefined, + categoryName, + }); + } + if (updatedField === 'enabled') { return translateLocal('workspaceActions.updateCategory', { oldValue: !!oldValue, @@ -2127,6 +2135,8 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction, policyID?: stri } if (updatedField === 'maxAmountNoReceipt' && typeof oldValue !== 'boolean' && typeof newValue !== 'boolean') { + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const maxExpenseAmountToDisplay = policy?.maxExpenseAmountNoReceipt === CONST.DISABLED_MAX_EXPENSE_VALUE ? 0 : policy?.maxExpenseAmountNoReceipt; @@ -2529,7 +2539,7 @@ function getRenamedAction(reportAction: OnyxEntry) { +function getAddedApprovalRuleMessage(reportAction: OnyxEntry) { const {name, approverAccountID, approverEmail, field, approverName} = getOriginalMessage(reportAction as ReportAction) ?? {}; @@ -2545,7 +2555,7 @@ function getAddedApprovaRulelMessage(reportAction: OnyxEntry) { return getReportActionText(reportAction); } -function getDeletedApprovaRulelMessage(reportAction: OnyxEntry) { +function getDeletedApprovalRuleMessage(reportAction: OnyxEntry) { const {name, approverAccountID, approverEmail, field, approverName} = getOriginalMessage(reportAction as ReportAction) ?? {}; @@ -2781,8 +2791,8 @@ export { getNumberOfMoneyRequests, getOneTransactionThreadReportID, getOriginalMessage, - getAddedApprovaRulelMessage, - getDeletedApprovaRulelMessage, + getAddedApprovalRuleMessage, + getDeletedApprovalRuleMessage, getUpdatedApprovalRuleMessage, getRemovedFromApprovalChainMessage, getDemotedFromWorkspaceMessage, diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index a848555936ae7..abf2e6fc07ec8 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -24,10 +24,10 @@ import Parser from './Parser'; import Performance from './Performance'; import {getCleanedTagName, getPolicy} from './PolicyUtils'; import { - getAddedApprovaRulelMessage, + getAddedApprovalRuleMessage, getAddedConnectionMessage, getCardIssuedMessage, - getDeletedApprovaRulelMessage, + getDeletedApprovalRuleMessage, getIntegrationSyncFailedMessage, getLastVisibleMessage, getMessageOfOldDotReportAction, @@ -689,9 +689,9 @@ function getOptionData({ } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE) { result.alternateText = getUpdatedAuditRateMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE) { - result.alternateText = getAddedApprovaRulelMessage(lastAction); + result.alternateText = getAddedApprovalRuleMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_APPROVER_RULE) { - result.alternateText = getDeletedApprovaRulelMessage(lastAction); + result.alternateText = getDeletedApprovalRuleMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE) { result.alternateText = getUpdatedApprovalRuleMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD) { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 65d1de66b950f..878954cced957 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -23,10 +23,10 @@ import {getCleanedTagName} from '@libs/PolicyUtils'; import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager'; import { getActionableMentionWhisperMessage, - getAddedApprovaRulelMessage, + getAddedApprovalRuleMessage, getAddedConnectionMessage, getCardIssuedMessage, - getDeletedApprovaRulelMessage, + getDeletedApprovalRuleMessage, getExportIntegrationMessageHTML, getIntegrationSyncFailedMessage, getIOUReportIDFromReportActionPreview, @@ -647,9 +647,9 @@ const ContextMenuActions: ContextMenuAction[] = [ } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE)) { setClipboardMessage(getUpdatedAuditRateMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE)) { - setClipboardMessage(getAddedApprovaRulelMessage(reportAction)); + setClipboardMessage(getAddedApprovalRuleMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_APPROVER_RULE)) { - setClipboardMessage(getDeletedApprovaRulelMessage(reportAction)); + setClipboardMessage(getDeletedApprovalRuleMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE)) { setClipboardMessage(getUpdatedApprovalRuleMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD)) { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 6b9056513e2bb..d08c4f7324547 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -58,9 +58,9 @@ import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils'; import {getCleanedTagName} from '@libs/PolicyUtils'; import { extractLinksFromMessageHtml, - getAddedApprovaRulelMessage, + getAddedApprovalRuleMessage, getAddedConnectionMessage, - getDeletedApprovaRulelMessage, + getDeletedApprovalRuleMessage, getDemotedFromWorkspaceMessage, getDismissedViolationMessageText, getIntegrationSyncFailedMessage, @@ -1122,9 +1122,9 @@ function PureReportActionItem({ } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_EMPLOYEE) { children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE)) { - children = ; + children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_APPROVER_RULE)) { - children = ; + children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE)) { children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REMOVED_FROM_APPROVAL_CHAIN)) {