From b5b7e769452cba757ca3b0cbe26fcb48acf11825 Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Mon, 18 Sep 2023 13:54:09 +0800 Subject: [PATCH 1/2] Add support for system messages for categories --- src/libs/ReportUtils.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index f24959c4bac2..d981c0fce42d 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1535,6 +1535,11 @@ function getModifiedExpenseMessage(reportAction) { if (hasModifiedMerchant) { return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.merchant, reportActionOriginalMessage.oldMerchant, Localize.translateLocal('common.merchant'), true); } + + const hasModifiedCategory = _.has(reportActionOriginalMessage, 'oldCategory') && _.has(reportActionOriginalMessage, 'category'); + if (hasModifiedCategory) { + return getProperSchemaForModifiedExpenseMessage(reportActionOriginalMessage.category, reportActionOriginalMessage.oldCategory, Localize.translateLocal('common.category'), true); + } } /** @@ -1575,6 +1580,11 @@ function getModifiedExpenseOriginalMessage(oldTransaction, transactionChanges, i originalMessage.currency = lodashGet(transactionChanges, 'currency', originalMessage.oldCurrency); } + if (_.has(transactionChanges, 'category')) { + originalMessage.oldCategory = TransactionUtils.getCategory(oldTransaction); + originalMessage.newCategory = transactionChanges.category; + } + return originalMessage; } From e8ab19d1db2bc08c6c9db5df26c9691000722662 Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Mon, 18 Sep 2023 15:16:12 +0800 Subject: [PATCH 2/2] Update src/libs/ReportUtils.js Co-authored-by: Vit Horacek <36083550+mountiny@users.noreply.github.com> --- src/libs/ReportUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index d981c0fce42d..9396ea921b61 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1582,7 +1582,7 @@ function getModifiedExpenseOriginalMessage(oldTransaction, transactionChanges, i if (_.has(transactionChanges, 'category')) { originalMessage.oldCategory = TransactionUtils.getCategory(oldTransaction); - originalMessage.newCategory = transactionChanges.category; + originalMessage.category = transactionChanges.category; } return originalMessage;