Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ import type {
UpdatedCustomFieldParams,
UpdatedPolicyApprovalRuleParams,
UpdatedPolicyAuditRateParams,
UpdatedPolicyCategoryDescriptionHintTypeParams,
UpdatedPolicyCategoryExpenseLimitTypeParams,
UpdatedPolicyCategoryGLCodeParams,
UpdatedPolicyCategoryMaxAmountNoReceiptParams,
Expand Down Expand Up @@ -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}`,
Expand Down
10 changes: 10 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ import type {
UpdatedCustomFieldParams,
UpdatedPolicyApprovalRuleParams,
UpdatedPolicyAuditRateParams,
UpdatedPolicyCategoryDescriptionHintTypeParams,
UpdatedPolicyCategoryExpenseLimitTypeParams,
UpdatedPolicyCategoryGLCodeParams,
UpdatedPolicyCategoryMaxAmountNoReceiptParams,
Expand Down Expand Up @@ -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}"`;
Expand Down
5 changes: 4 additions & 1 deletion src/languages/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -961,6 +963,7 @@ export type {
UpdatedPolicyCurrencyParams,
UpdatedPolicyFrequencyParams,
UpdatedPolicyCategoryParams,
UpdatedPolicyCategoryDescriptionHintTypeParams,
UpdatedPolicyCategoryNameParams,
UpdatedPolicyPreventSelfApprovalParams,
UpdatedPolicyFieldWithNewAndOldValueParams,
Expand Down
18 changes: 14 additions & 4 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -2529,7 +2539,7 @@ function getRenamedAction(reportAction: OnyxEntry<ReportAction<typeof CONST.REPO
});
}

function getAddedApprovaRulelMessage(reportAction: OnyxEntry<ReportAction>) {
function getAddedApprovalRuleMessage(reportAction: OnyxEntry<ReportAction>) {
const {name, approverAccountID, approverEmail, field, approverName} =
getOriginalMessage(reportAction as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE>) ?? {};

Expand All @@ -2545,7 +2555,7 @@ function getAddedApprovaRulelMessage(reportAction: OnyxEntry<ReportAction>) {
return getReportActionText(reportAction);
}

function getDeletedApprovaRulelMessage(reportAction: OnyxEntry<ReportAction>) {
function getDeletedApprovalRuleMessage(reportAction: OnyxEntry<ReportAction>) {
const {name, approverAccountID, approverEmail, field, approverName} =
getOriginalMessage(reportAction as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_APPROVER_RULE>) ?? {};

Expand Down Expand Up @@ -2781,8 +2791,8 @@ export {
getNumberOfMoneyRequests,
getOneTransactionThreadReportID,
getOriginalMessage,
getAddedApprovaRulelMessage,
getDeletedApprovaRulelMessage,
getAddedApprovalRuleMessage,
getDeletedApprovalRuleMessage,
getUpdatedApprovalRuleMessage,
getRemovedFromApprovalChainMessage,
getDemotedFromWorkspaceMessage,
Expand Down
8 changes: 4 additions & 4 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)) {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/home/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils';
import {getCleanedTagName} from '@libs/PolicyUtils';
import {
extractLinksFromMessageHtml,
getAddedApprovaRulelMessage,
getAddedApprovalRuleMessage,
getAddedConnectionMessage,
getDeletedApprovaRulelMessage,
getDeletedApprovalRuleMessage,
getDemotedFromWorkspaceMessage,
getDismissedViolationMessageText,
getIntegrationSyncFailedMessage,
Expand Down Expand Up @@ -1122,9 +1122,9 @@ function PureReportActionItem({
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_EMPLOYEE) {
children = <ReportActionItemBasicMessage message={getPolicyChangeLogDeleteMemberMessage(action)} />;
} else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE)) {
children = <ReportActionItemBasicMessage message={getAddedApprovaRulelMessage(action)} />;
children = <ReportActionItemBasicMessage message={getAddedApprovalRuleMessage(action)} />;
} else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_APPROVER_RULE)) {
children = <ReportActionItemBasicMessage message={getDeletedApprovaRulelMessage(action)} />;
children = <ReportActionItemBasicMessage message={getDeletedApprovalRuleMessage(action)} />;
} else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE)) {
children = <ReportActionItemBasicMessage message={getUpdatedApprovalRuleMessage(action)} />;
} else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REMOVED_FROM_APPROVAL_CHAIN)) {
Expand Down
Loading