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
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1677,6 +1677,7 @@ const CONST = {
UPDATE_AUTO_HARVESTING: 'POLICYCHANGELOG_UPDATE_AUTOHARVESTING',
UPDATE_AUTO_REIMBURSEMENT: 'POLICYCHANGELOG_UPDATE_AUTOREIMBURSEMENT',
UPDATE_AUTO_PAY_APPROVED_REPORTS_ENABLED: 'POLICYCHANGELOG_UPDATE_AUTO_PAY_APPROVED_REPORTS_ENABLED',
UPDATE_MCC_GROUP_CATEGORY: 'POLICYCHANGELOG_UPDATE_MCC_GROUP_CATEGORY',
UPDATE_AUTO_REPORTING_FREQUENCY: 'POLICYCHANGELOG_UPDATE_AUTOREPORTING_FREQUENCY',
UPDATE_BUDGET: 'POLICYCHANGELOG_UPDATE_BUDGET',
UPDATE_CATEGORY: 'POLICYCHANGELOG_UPDATE_CATEGORY',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7824,6 +7824,8 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
`Kartenfeed-Tag für das Abrechnungsperiodenende von „${feedName}“ geändert${newValue ? ` in „${newValue}“` : ''}${previousValue ? ` (zuvor „${previousValue}“)` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`${fieldType}-Berichtsfeld „${fieldName}“${defaultValue ? ` mit Standardwert „${defaultValue}“` : ''} hinzugefügt`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`hat die Standardausgabenkategorie für „${mccGroupName}“ in „${newCategory}“ geändert (zuvor „${oldCategory}“)`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'aktiviert' : 'deaktiviert'} die Anforderung für Firmenkartenkäufe`,
expensifyCardRule: {
actionVerb: {block: 'blockiert', allow: 'erlaubt'},
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7800,6 +7800,8 @@ const translations = {
updatedAutoPayApprovedReportsLimit: ({oldLimit, newLimit}: {oldLimit: string; newLimit: string}) =>
`changed the auto-pay approved reports threshold to "${newLimit}" (previously "${oldLimit}")`,
removedAutoPayApprovedReportsLimit: 'removed the auto-pay approved reports threshold',
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`changed the default spend category for "${mccGroupName}" to "${newCategory}" (previously "${oldCategory}")`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rayane-d Can you make the messages similar to getAutoReimbursementMessage?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shubham1206agra Do you mean the "set …", "updated …", "removed …" pattern? I intentionally used only "changed …" because MCC groups always have a default category assigned at creation time. Since the product does not allow those default values to be removed, the only supported action in this case is changing them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2026-06-02 at 6 18 18 PM

@rayane-d Are you sure as I can see this on my policy?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shubham1206agra I think the case you're seeing happens when a category that was selected in one of the default spend categories is disabled or deleted. In that situation, the value becomes "Uncategorized".

Since we already log a changelog system message when a category is disabled or deleted, I don't think we need to create duplicate changelog entries for the resulting default spend category removal.

Also, when a category is later assigned to one of these default spend categories, we correctly log a changelog with "Uncategorized" as the previous value.

Example:
changed the default spend category for "Airlines" to "Interest" (previously "Uncategorized")

Screenshot1 Screenshot2 Screenshot 3

changedDefaultApprover: ({newApprover, previousApprover}: {newApprover: string; previousApprover?: string}) =>
previousApprover ? `changed the default approver to ${newApprover} (previously ${previousApprover})` : `changed the default approver to ${newApprover}`,
changedSubmitsToApprover: ({
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7581,6 +7581,8 @@ ${amount} para ${merchant} - ${date}`,
updatedAutoPayApprovedReportsLimit: ({oldLimit, newLimit}: {oldLimit: string; newLimit: string}) =>
`cambió el umbral de autopago de informes aprobados a "${newLimit}" (previamente "${oldLimit}")`,
removedAutoPayApprovedReportsLimit: 'eliminó el umbral de autopago de informes aprobados',
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`cambió la categoría de gasto predeterminada para "${mccGroupName}" a "${newCategory}" (previamente "${oldCategory}")`,
changedDefaultApprover: ({newApprover, previousApprover}: {newApprover: string; previousApprover?: string}) =>
previousApprover ? `cambió el aprobador predeterminado a ${newApprover} (anteriormente ${previousApprover})` : `cambió el aprobador predeterminado a ${newApprover}`,
changedSubmitsToApprover: ({
Expand Down
2 changes: 2 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7857,6 +7857,8 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
`a modifié le jour de fin de période de relevé du flux de carte « ${feedName} »${newValue ? ` à « ${newValue} »` : ''}${previousValue ? ` (précédemment « ${previousValue} »)` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`a ajouté le champ de note de frais ${fieldType} « ${fieldName} »${defaultValue ? ` avec la valeur par défaut « ${defaultValue} »` : ''}`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`a modifié la catégorie de dépense par défaut pour « ${mccGroupName} » en « ${newCategory} » (auparavant « ${oldCategory} »)`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'activé' : 'désactivé'} l’exigence d’achats par carte d’entreprise`,
expensifyCardRule: {
actionVerb: {block: 'bloqué', allow: 'autorisé'},
Expand Down
2 changes: 2 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7812,6 +7812,8 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
`ha modificato il giorno di fine periodo dell’estratto conto del flusso carta "${feedName}"${newValue ? ` a "${newValue}"` : ''}${previousValue ? ` (in precedenza "${previousValue}")` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`aggiunto campo di report ${fieldType} "${fieldName}"${defaultValue ? ` con valore predefinito "${defaultValue}"` : ''}`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`ha modificato la categoria di spesa predefinita per "${mccGroupName}" in "${newCategory}" (precedentemente "${oldCategory}")`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'abilitato' : 'disabilitato'} il requisito per gli acquisti con carta aziendale`,
expensifyCardRule: {
actionVerb: {block: 'bloccato', allow: 'consentito'},
Expand Down
2 changes: 2 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7720,6 +7720,8 @@ ${reportName}
`カード明細フィード「${feedName}」の利用明細期間の終了日を変更しました${newValue ? ` を「${newValue}」に` : ''}${previousValue ? ` (以前の値:「${previousValue}」)` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`${fieldType}レポートフィールド「${fieldName}」を追加しました${defaultValue ? ` デフォルト値「${defaultValue}」付き` : ''}`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`「${mccGroupName}」のデフォルト支出カテゴリーを「${newCategory}」に変更しました(以前は「${oldCategory}」)`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? '有効' : '無効'} の法人カード購入要件`,
expensifyCardRule: {
actionVerb: {block: 'ブロック済み', allow: '許可済み'},
Expand Down
2 changes: 2 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7782,6 +7782,8 @@ er bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
`heeft de einddag van de afrekenperiode van kaartfeed "${feedName}" gewijzigd${newValue ? ` naar "${newValue}"` : ''}${previousValue ? ` (voorheen "${previousValue}")` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`heeft ${fieldType}-rapportveld "${fieldName}" toegevoegd${defaultValue ? ` met standaardwaarde "${defaultValue}"` : ''}`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`heeft de standaarduitgavencategorie voor ‘${mccGroupName}’ gewijzigd in ‘${newCategory}’ (voorheen ‘${oldCategory}’)`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `vereiste ${enabled ? 'ingeschakeld' : 'uitgeschakeld'} voor bedrijfskaarttransacties`,
expensifyCardRule: {
actionVerb: {block: 'geblokkeerd', allow: 'toegestaan'},
Expand Down
2 changes: 2 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7772,6 +7772,8 @@ Dodaj więcej zasad wydatków, żeby chronić płynność finansową firmy.`,
`zmienił dzień zakończenia okresu rozliczeniowego dla źródła karty „${feedName}”${newValue ? ` na „${newValue}”` : ''}${previousValue ? ` (wcześniej „${previousValue}”)` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`dodano pole raportu typu ${fieldType} „${fieldName}”${defaultValue ? ` z domyślną wartością „${defaultValue}”` : ''}`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`zmieniono domyślną kategorię wydatków dla „${mccGroupName}” na „${newCategory}” (poprzednio „${oldCategory}”)`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'włączone' : 'wyłączone'} wymóg dotyczący zakupów kartą służbową`,
expensifyCardRule: {
actionVerb: {block: 'zablokowane', allow: 'dozwolone'},
Expand Down
2 changes: 2 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7774,6 +7774,8 @@ Adicione mais regras de gasto para proteger o fluxo de caixa da empresa.`,
`changed card feed "${feedName}" statement period end day${newValue ? ` para "${newValue}"` : ''}${previousValue ? `(antes " ${previousValue}")` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`adicionou o campo de relatório ${fieldType} "${fieldName}"${defaultValue ? ` com valor padrão "${defaultValue}"` : ''}`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`alterou a categoria de gasto padrão de "${mccGroupName}" para "${newCategory}" (antes "${oldCategory}")`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'ativado' : 'desativado'} o requisito de compras com cartão corporativo`,
expensifyCardRule: {
actionVerb: {block: 'bloqueado', allow: 'permitido'},
Expand Down
2 changes: 2 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7573,6 +7573,8 @@ ${reportName}
updatedCardFeedLiability: (feedName: string, enabled: boolean) => `允许 ${enabled ? '已启用' : '已禁用'} 持卡人删除卡片交易(卡片流水来源:“${feedName}”)`,
updatedCardFeedStatementPeriod: (feedName: string, newValue?: string, previousValue?: string) =>
`已更改卡片流水“${feedName}”的账单周期截止日${newValue ? ` 为“${newValue}”` : ''}${previousValue ? ` (先前为“${previousValue}”)` : ''}`,
updatedMccGroupCategory: ({mccGroupName, oldCategory, newCategory}: {mccGroupName: string; oldCategory: string; newCategory: string}) =>
`已将“${mccGroupName}”的默认支出类别更改为“${newCategory}”(此前为“${oldCategory}”)`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) => `已添加 ${fieldType} 报告字段“${fieldName}”${defaultValue ? ` 默认值为“${defaultValue}”` : ''}`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? '已启用' : '已禁用'} 公司商务卡消费要求`,
expensifyCardRule: {
Expand Down
4 changes: 4 additions & 0 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {
getLastVisibleActionIncludingTransactionThread,
getLastVisibleMessage,
getMarkedReimbursedMessage,
getMccGroupCategoryMessage,
getMentionedAccountIDsFromAction,
getMessageOfOldDotReportAction,
getOneTransactionThreadReportID,
Expand Down Expand Up @@ -924,6 +925,9 @@ function getLastMessageTextForReport({
if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REIMBURSEMENT)) {
lastMessageTextFromReport = getAutoReimbursementMessage(translate, lastReportAction);
}
if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MCC_GROUP_CATEGORY)) {
lastMessageTextFromReport = getMccGroupCategoryMessage(translate, lastReportAction);
}
if (
isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_TAX) ||
isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_TAX) ||
Expand Down
11 changes: 11 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3456,6 +3456,16 @@ function getAutoReimbursementMessage(translate: LocalizedTranslate, action: Repo
return getReportActionText(action);
}

function getMccGroupCategoryMessage(translate: LocalizedTranslate, action: ReportAction): string {
const {mccGroupName, oldCategory, newCategory} = getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MCC_GROUP_CATEGORY>) ?? {};

if (!mccGroupName || !oldCategory || !newCategory) {
return getReportActionText(action);
}

return translate('workspaceActions.updatedMccGroupCategory', {mccGroupName, oldCategory, newCategory});
}

type DefaultApproverOriginalMessage = {
approver: {email: string; name: string; accountID: number};
previousApprover?: {email: string; name: string; accountID: number};
Expand Down Expand Up @@ -4732,6 +4742,7 @@ export {
getRequireCompanyCardsEnabledMessage,
getAutoPayApprovedReportsEnabledMessage,
getAutoReimbursementMessage,
getMccGroupCategoryMessage,
formatAddressToString,
getCompanyAddressUpdateMessage,
getDefaultApproverUpdateMessage,
Expand Down
4 changes: 4 additions & 0 deletions src/libs/ReportNameUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {
getJoinRequestMessage,
getLinkedTransactionID,
getMarkedReimbursedMessage,
getMccGroupCategoryMessage,
getMessageOfOldDotReportAction,
getOriginalMessage,
getPlaidBalanceFailureMessage,
Expand Down Expand Up @@ -582,6 +583,9 @@ function computeReportNameBasedOnReportAction(
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REIMBURSEMENT)) {
return getAutoReimbursementMessage(translate, parentReportAction);
}
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MCC_GROUP_CATEGORY)) {
return getMccGroupCategoryMessage(translate, parentReportAction);
}
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DEFAULT_APPROVER)) {
return getDefaultApproverUpdateMessage(translate, parentReportAction);
}
Expand Down
3 changes: 3 additions & 0 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import {
getInvoiceCompanyWebsiteUpdateMessage,
getIOUReportIDFromReportActionPreview,
getLastVisibleMessage,
getMccGroupCategoryMessage,
getMessageOfOldDotReportAction,
getOriginalMessage,
getPlaidBalanceFailureMessage,
Expand Down Expand Up @@ -1118,6 +1119,8 @@ function getOptionData({
result.alternateText = getAutoPayApprovedReportsEnabledMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REIMBURSEMENT) {
result.alternateText = getAutoReimbursementMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MCC_GROUP_CATEGORY) {
result.alternateText = getMccGroupCategoryMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DEFAULT_APPROVER) {
result.alternateText = getDefaultApproverUpdateMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_SUBMITS_TO) {
Expand Down
3 changes: 3 additions & 0 deletions src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import {
getIOUReportIDFromReportActionPreview,
getJoinRequestMessage,
getMarkedReimbursedMessage,
getMccGroupCategoryMessage,
getMemberChangeMessageFragment,
getMessageOfOldDotReportAction,
getOriginalMessage,
Expand Down Expand Up @@ -976,6 +977,8 @@ const ContextMenuActions: ContextMenuAction[] = [
Clipboard.setString(getRequireCompanyCardsEnabledMessage(translate, reportAction));
} else if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REIMBURSEMENT) {
Clipboard.setString(getAutoReimbursementMessage(translate, reportAction));
} else if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MCC_GROUP_CATEGORY) {
Clipboard.setString(getMccGroupCategoryMessage(translate, reportAction));
} else if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_INVOICE_COMPANY_NAME) {
Clipboard.setString(getInvoiceCompanyNameUpdateMessage(translate, reportAction));
} else if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_INVOICE_COMPANY_WEBSITE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
getForwardsToUpdateMessage,
getInvoiceCompanyNameUpdateMessage,
getInvoiceCompanyWebsiteUpdateMessage,
getMccGroupCategoryMessage,
getPolicyChangeLogAddEmployeeMessage,
getPolicyChangeLogDefaultBillableMessage,
getPolicyChangeLogDefaultReimbursableMessage,
Expand Down Expand Up @@ -144,6 +145,7 @@ const POLICY_CHANGE_LOG_RESOLVERS: Record<string, ResolverFn> = {
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FORWARDS_TO]: (translate, action) => getForwardsToUpdateMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_PAY_APPROVED_REPORTS_ENABLED]: (translate, action) => getAutoPayApprovedReportsEnabledMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REIMBURSEMENT]: (translate, action) => getAutoReimbursementMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MCC_GROUP_CATEGORY]: (translate, action) => getMccGroupCategoryMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_INVOICE_COMPANY_NAME]: (translate, action) => getInvoiceCompanyNameUpdateMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_INVOICE_COMPANY_WEBSITE]: (translate, action) => getInvoiceCompanyWebsiteUpdateMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REIMBURSER]: (translate, action) => getReimburserUpdateMessage(translate, action),
Expand Down
9 changes: 9 additions & 0 deletions src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,15 @@ type OriginalMessagePolicyChangeLog = {
/** New default reimbursable value */
newDefaultReimbursable?: string;

/** MCC group name whose default spend category changed (e.g. "Airlines") */
mccGroupName?: string;

/** Previous category name for the MCC group */
oldCategory?: string;

/** New category name for the MCC group */
newCategory?: string;

/** Old default report title formula */
oldDefaultTitle?: string;

Expand Down
29 changes: 29 additions & 0 deletions tests/unit/OptionsListUtilsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5248,6 +5248,35 @@ describe('OptionsListUtils', () => {
);
});
});
describe('UPDATE_MCC_GROUP_CATEGORY action', () => {
it('should surface the friendly MCC group label in the last-message preview', async () => {
const report: Report = createRandomReport(0, undefined);
const changelogAction: ReportAction = {
...createRandomReportAction(1),
actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MCC_GROUP_CATEGORY,
message: [{type: 'COMMENT', text: ''}],
originalMessage: {
mccGroupName: 'Airlines',
oldCategory: 'Insurance',
newCategory: 'Travel',
},
};
await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, {
[changelogAction.reportActionID]: changelogAction,
});

const lastMessage = getLastMessageTextForReport({
translate: translateLocal,
report,
lastActorDetails: null,
policy: undefined,
isReportArchived: false,
currentUserLogin: CURRENT_USER_EMAIL,
});

expect(lastMessage).toBe('changed the default spend category for "Airlines" to "Travel" (previously "Insurance")');
});
});
});

describe('getPersonalDetailSearchTerms', () => {
Expand Down
Loading
Loading