From 76901b44020061ce6cd41ebd6286ade1f11225dd Mon Sep 17 00:00:00 2001
From: Shubham Agrawal <shubham.agra1206@gmail.com>
Date: Fri, 20 Mar 2026 22:03:38 +0530
Subject: [PATCH 1/4] Refactor: ReportUtils from translateLocal to translate
 from hook (part 6)

---
 src/libs/ReportNameUtils.ts |  82 ++++++++++++++++++------
 src/libs/ReportUtils.ts     | 122 ++++--------------------------------
 2 files changed, 75 insertions(+), 129 deletions(-)

diff --git a/src/libs/ReportNameUtils.ts b/src/libs/ReportNameUtils.ts
index bfc3ffd2ebd5..62e4508c303a 100644
--- a/src/libs/ReportNameUtils.ts
+++ b/src/libs/ReportNameUtils.ts
@@ -44,6 +44,7 @@ import {
     getCustomTaxNameUpdateMessage,
     getDefaultApproverUpdateMessage,
     getDismissedViolationMessageText,
+    getExportIntegrationLastMessageText,
     getForeignCurrencyDefaultTaxUpdateMessage,
     getForwardsToUpdateMessage,
     getIntegrationSyncFailedMessage,
@@ -64,6 +65,7 @@ import {
     getReimburserUpdateMessage,
     getRenamedAction,
     getReportActionMessage as getReportActionMessageFromActionsUtils,
+    getReportActionMessageText,
     getReportActionText,
     getSettlementAccountLockedMessage,
     getSubmitsToUpdateMessage,
@@ -86,6 +88,7 @@ import {
     getWorkspaceUpdateFieldMessage,
     isActionableJoinRequest,
     isActionOfType,
+    isApprovedOrSubmittedReportAction,
     isCardIssuedAction,
     isMarkAsClosedAction,
     isModifiedExpenseAction,
@@ -93,6 +96,8 @@ import {
     isMovedAction,
     isOldDotReportAction,
     isOriginalReportDeleted,
+    isReimbursementDeQueuedOrCanceledAction,
+    isReimbursementQueuedAction,
     isRejectedAction,
     isRenamedAction,
     isReportActionAttachment,
@@ -110,6 +115,8 @@ import {
     getParentReport,
     getPolicyChangeMessage,
     getPolicyName,
+    getReimbursementDeQueuedOrCanceledActionMessage,
+    getReimbursementQueuedActionMessage,
     getReportMetadata,
     getReportOrDraftReport,
     getTransactionReportName,
@@ -396,10 +403,12 @@ function getMoneyRequestReportName({report, policy, invoiceReceiverPolicy}: {rep
 
 function computeReportNameBasedOnReportAction(
     translate: LocalizedTranslate,
+    formatPhoneNumber: LocaleContextProps['formatPhoneNumber'],
     parentReportAction: ReportAction | undefined,
     report: Report | undefined,
     reportPolicy: Policy | undefined,
     parentReport: Report | undefined,
+    personalDetailsList: OnyxEntry<PersonalDetailsList>,
 ): string | undefined {
     if (!parentReportAction) {
         return undefined;
@@ -426,9 +435,38 @@ function computeReportNameBasedOnReportAction(
     if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) {
         return translate('iou.heldExpense');
     }
+    if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION) {
+        return getExportIntegrationLastMessageText(translate, parentReportAction);
+    }
     if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) {
         return translate('iou.unheldExpense');
     }
+    if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTEDTRANSACTION_THREAD) {
+        return translate('iou.reject.reportActions.rejectedExpense');
+    }
+    if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED_TRANSACTION_MARKASRESOLVED) {
+        return translate('iou.reject.reportActions.markedAsResolved');
+    }
+    if (isApprovedOrSubmittedReportAction(parentReportAction) || isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.REIMBURSED)) {
+        return getReportActionMessageText(parentReportAction);
+    }
+    if (isReimbursementQueuedAction(parentReportAction)) {
+        return getReimbursementQueuedActionMessage({
+            reportAction: parentReportAction,
+            report: parentReport,
+            translate,
+            formatPhoneNumber,
+            shouldUseShortDisplayName: false,
+            personalDetails: personalDetailsList,
+        });
+    }
+    if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.RECEIPT_SCAN_FAILED) {
+        return translate('iou.receiptScanningFailed');
+    }
+
+    if (isReimbursementDeQueuedOrCanceledAction(parentReportAction)) {
+        return getReimbursementDeQueuedOrCanceledActionMessage(translate, parentReportAction, parentReport);
+    }
     if (isRejectedAction(parentReportAction)) {
         return translate('iou.rejectedThisReport');
     }
@@ -678,6 +716,22 @@ function computeReportNameBasedOnReportAction(
         return Parser.htmlToText(getSettlementAccountLockedMessage(translate, parentReportAction));
     }
 
+    if (isOldDotReportAction(parentReportAction)) {
+        return getMessageOfOldDotReportAction(translate, parentReportAction);
+    }
+
+    if (isRenamedAction(parentReportAction)) {
+        return getRenamedAction(translate, parentReportAction, isExpenseReport(parentReport));
+    }
+
+    if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.RESOLVED_DUPLICATES)) {
+        return translate('violations.resolvedDuplicates');
+    }
+
+    if (isCardIssuedAction(parentReportAction)) {
+        return getCardIssuedMessage({reportAction: parentReportAction, translate});
+    }
+
     return undefined;
 }
 
@@ -710,23 +764,10 @@ function computeChatThreadReportName(
         return formatReportLastMessageText(formattedName);
     }
 
-    if (!isEmptyObject(parentReportAction) && isOldDotReportAction(parentReportAction)) {
-        return getMessageOfOldDotReportAction(translate, parentReportAction);
-    }
-
-    if (isRenamedAction(parentReportAction)) {
-        const parent = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`];
-        return getRenamedAction(translate, parentReportAction, isExpenseReport(parent));
-    }
-
     if (parentReportActionMessage?.isDeletedParentAction) {
         return translate('parentReportAction.deletedMessage');
     }
 
-    if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.RESOLVED_DUPLICATES) {
-        return translate('violations.resolvedDuplicates');
-    }
-
     const isAttachment = isReportActionAttachment(!isEmptyObject(parentReportAction) ? parentReportAction : undefined);
     const reportActionMessage = getReportActionText(parentReportAction).replaceAll(/(\n+|\r\n|\n|\r)/gm, ' ');
     if (isAttachment && reportActionMessage) {
@@ -765,9 +806,6 @@ function computeChatThreadReportName(
     if (isTripRoom(report) && report?.reportName !== CONST.REPORT.DEFAULT_REPORT_NAME) {
         return report?.reportName ?? '';
     }
-    if (isCardIssuedAction(parentReportAction)) {
-        return getCardIssuedMessage({reportAction: parentReportAction, translate});
-    }
     return reportActionMessage;
 }
 
@@ -795,8 +833,16 @@ function computeReportName({
     const parentReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`];
     const parentReportAction = isThread(report) ? reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`]?.[report.parentReportActionID] : undefined;
 
-    // eslint-disable-next-line @typescript-eslint/no-deprecated
-    const parentReportActionBasedName = computeReportNameBasedOnReportAction(translateLocal, parentReportAction, report, reportPolicy, parentReport);
+    const parentReportActionBasedName = computeReportNameBasedOnReportAction(
+        // eslint-disable-next-line @typescript-eslint/no-deprecated
+        translateLocal,
+        formatPhoneNumberPhoneUtils,
+        parentReportAction,
+        report,
+        reportPolicy,
+        parentReport,
+        personalDetailsList,
+    );
 
     if (parentReportActionBasedName) {
         return parentReportActionBasedName;
diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts
index 287d11c620b0..3a8b83128c74 100644
--- a/src/libs/ReportUtils.ts
+++ b/src/libs/ReportUtils.ts
@@ -183,28 +183,23 @@ import {
     formatLastMessageText,
     getActionableJoinRequestPendingReportAction,
     getAllReportActions,
-    getCardIssuedMessage,
     getCreatedReportForUnapprovedTransactionsMessage,
-    getExportIntegrationLastMessageText,
     getIOUActionForTransactionID,
     getIOUReportIDFromReportActionPreview,
     getLastVisibleAction,
     getLastVisibleAction as getLastVisibleActionReportActionsUtils,
     getLastVisibleMessage as getLastVisibleMessageActionUtils,
     getLastVisibleMessage as getLastVisibleMessageReportActionsUtils,
-    getMessageOfOldDotReportAction,
     getMostRecentActiveDEWApproveFailedAction,
     getMostRecentActiveDEWSubmitFailedAction,
     getNumberOfMoneyRequests,
     getOneTransactionThreadReportAction,
     getOneTransactionThreadReportID,
     getOriginalMessage,
-    getRenamedAction,
     getReportAction,
     getReportActionActorAccountID,
     getReportActionHtml,
     getReportActionMessage as getReportActionMessageReportUtils,
-    getReportActionMessageText,
     getReportActionText,
     getSortedReportActions,
     isActionableCardFraudAlert,
@@ -212,8 +207,6 @@ import {
     isActionableTrackExpense,
     isActionOfType,
     isApprovedAction,
-    isApprovedOrSubmittedReportAction,
-    isCardIssuedAction,
     isCreatedTaskReportAction,
     isCurrentActionUnread,
     isDeletedAction,
@@ -225,12 +218,9 @@ import {
     isModifiedExpenseAction,
     isMoneyRequestAction,
     isMovedAction,
-    isOldDotReportAction,
     isPendingRemove,
     isPolicyChangeLogAction,
-    isReimbursementDeQueuedOrCanceledAction,
     isReimbursementQueuedAction,
-    isRenamedAction,
     isReopenedAction,
     isReportActionAttachment,
     isReportActionVisible,
@@ -5732,75 +5722,6 @@ function parseReportActionHtmlToText(reportAction: OnyxEntry<ReportAction>, repo
     return textMessage;
 }
 
-/**
- * Get the report action message for a report action.
- */
-function getReportActionMessage({
-    reportAction,
-    translate,
-    formatPhoneNumber,
-    reportID,
-    childReportID,
-    reports,
-    personalDetails,
-    conciergeReportID,
-}: {
-    reportAction: OnyxEntry<ReportAction>;
-    translate: LocalizedTranslate;
-    formatPhoneNumber: LocaleContextProps['formatPhoneNumber'];
-    reportID?: string;
-    childReportID?: string;
-    reports?: Report[];
-    personalDetails?: Partial<PersonalDetailsList>;
-    conciergeReportID: string | undefined;
-}) {
-    if (isEmptyObject(reportAction)) {
-        return '';
-    }
-    if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) {
-        return translate('iou.heldExpense');
-    }
-
-    if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION) {
-        return getExportIntegrationLastMessageText(translate, reportAction);
-    }
-
-    if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) {
-        return translate('iou.unheldExpense');
-    }
-
-    if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTEDTRANSACTION_THREAD) {
-        return translate('iou.reject.reportActions.rejectedExpense');
-    }
-
-    if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED_TRANSACTION_MARKASRESOLVED) {
-        return translate('iou.reject.reportActions.markedAsResolved');
-    }
-
-    if (isApprovedOrSubmittedReportAction(reportAction) || isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.REIMBURSED)) {
-        return getReportActionMessageText(reportAction);
-    }
-    if (isReimbursementQueuedAction(reportAction)) {
-        return getReimbursementQueuedActionMessage({
-            reportAction,
-            report: getReportOrDraftReport(reportID, reports),
-            translate,
-            formatPhoneNumber,
-            shouldUseShortDisplayName: false,
-            personalDetails,
-        });
-    }
-    if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.RECEIPT_SCAN_FAILED) {
-        return translate('iou.receiptScanningFailed');
-    }
-
-    if (isReimbursementDeQueuedOrCanceledAction(reportAction)) {
-        return getReimbursementDeQueuedOrCanceledActionMessage(translate, reportAction, getReportOrDraftReport(reportID, reports));
-    }
-
-    return parseReportActionHtmlToText(reportAction, reportID, conciergeReportID, childReportID);
-}
-
 /**
  * Get the title for a report.
  * @deprecated Moved to src/libs/ReportNameUtils.ts.
@@ -5830,8 +5751,16 @@ function getReportName(reportNameInformation: GetReportNameParams): string {
 
     const reportPolicy = policy ?? allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`];
 
-    // eslint-disable-next-line @typescript-eslint/no-deprecated
-    const parentReportActionBasedName = computeReportNameBasedOnReportAction(translateLocal, parentReportAction, report, reportPolicy, parentReport);
+    const parentReportActionBasedName = computeReportNameBasedOnReportAction(
+        // eslint-disable-next-line @typescript-eslint/no-deprecated
+        translateLocal,
+        formatPhoneNumberPhoneUtils,
+        parentReportAction,
+        report,
+        reportPolicy,
+        parentReport,
+        personalDetails as PersonalDetailsList,
+    );
 
     if (parentReportActionBasedName) {
         return parentReportActionBasedName;
@@ -5862,38 +5791,13 @@ function getReportName(reportNameInformation: GetReportNameParams): string {
             return formatReportLastMessageText(formattedName);
         }
 
-        if (!isEmptyObject(parentReportAction) && isOldDotReportAction(parentReportAction)) {
-            // eslint-disable-next-line @typescript-eslint/no-deprecated
-            return getMessageOfOldDotReportAction(translateLocal, parentReportAction);
-        }
-
-        if (isRenamedAction(parentReportAction)) {
-            // eslint-disable-next-line @typescript-eslint/no-deprecated
-            return getRenamedAction(translateLocal, parentReportAction, isExpenseReport(getReport(report.parentReportID, allReports)));
-        }
-
         if (parentReportActionMessage?.isDeletedParentAction) {
             // eslint-disable-next-line @typescript-eslint/no-deprecated
             return translateLocal('parentReportAction.deletedMessage');
         }
 
-        if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.RESOLVED_DUPLICATES) {
-            // eslint-disable-next-line @typescript-eslint/no-deprecated
-            return translateLocal('violations.resolvedDuplicates');
-        }
-
         const isAttachment = isReportActionAttachment(!isEmptyObject(parentReportAction) ? parentReportAction : undefined);
-        const reportActionMessage = getReportActionMessage({
-            reportAction: parentReportAction,
-            // eslint-disable-next-line @typescript-eslint/no-deprecated
-            translate: translateLocal,
-            formatPhoneNumber: formatPhoneNumberPhoneUtils,
-            reportID: report?.parentReportID,
-            childReportID: report?.reportID,
-            reports,
-            personalDetails,
-            conciergeReportID,
-        }).replaceAll(/(\n+|\r\n|\n|\r)/gm, ' ');
+        const reportActionMessage = parseReportActionHtmlToText(parentReportAction, report?.parentReportID, conciergeReportID, report?.reportID).replaceAll(/(\n+|\r\n|\n|\r)/gm, ' ');
         if (isAttachment && reportActionMessage) {
             // eslint-disable-next-line @typescript-eslint/no-deprecated
             return `[${translateLocal('common.attachment')}]`;
@@ -5933,10 +5837,6 @@ function getReportName(reportNameInformation: GetReportNameParams): string {
         if (isTripRoom(report) && report?.reportName !== CONST.REPORT.DEFAULT_REPORT_NAME) {
             return report?.reportName ?? '';
         }
-        if (isCardIssuedAction(parentReportAction)) {
-            // eslint-disable-next-line @typescript-eslint/no-deprecated
-            return getCardIssuedMessage({reportAction: parentReportAction, translate: translateLocal});
-        }
         return reportActionMessage;
     }
 

From 8346b52061d8bc18441665ddef00418e06e606e1 Mon Sep 17 00:00:00 2001
From: Shubham Agrawal <shubham.agra1206@gmail.com>
Date: Sat, 21 Mar 2026 12:47:14 +0530
Subject: [PATCH 2/4] Fixed edge cases

---
 src/libs/ReportActionsUtils.ts           | 2 ++
 src/libs/ReportNameUtils.ts              | 5 -----
 tests/utils/collections/reportActions.ts | 1 +
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts
index f59a6a57003c..6da23b71f95d 100644
--- a/src/libs/ReportActionsUtils.ts
+++ b/src/libs/ReportActionsUtils.ts
@@ -2023,6 +2023,7 @@ function isOldDotLegacyAction(action: OldDotReportAction | PartialReportAction):
         CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_QUICK_BOOKS,
         CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED,
         CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP,
+        CONST.REPORT.ACTIONS.TYPE.REIMBURSED,
     ].some((oldDotActionName) => oldDotActionName === action?.actionName);
 }
 
@@ -2053,6 +2054,7 @@ function isOldDotReportAction(action: ReportAction | OldDotReportAction) {
         CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_QUICK_BOOKS,
         CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED,
         CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP,
+        CONST.REPORT.ACTIONS.TYPE.REIMBURSED,
     ].some((oldDotActionName) => oldDotActionName === action.actionName);
 }
 
diff --git a/src/libs/ReportNameUtils.ts b/src/libs/ReportNameUtils.ts
index 62e4508c303a..2a71e22f7f76 100644
--- a/src/libs/ReportNameUtils.ts
+++ b/src/libs/ReportNameUtils.ts
@@ -65,7 +65,6 @@ import {
     getReimburserUpdateMessage,
     getRenamedAction,
     getReportActionMessage as getReportActionMessageFromActionsUtils,
-    getReportActionMessageText,
     getReportActionText,
     getSettlementAccountLockedMessage,
     getSubmitsToUpdateMessage,
@@ -88,7 +87,6 @@ import {
     getWorkspaceUpdateFieldMessage,
     isActionableJoinRequest,
     isActionOfType,
-    isApprovedOrSubmittedReportAction,
     isCardIssuedAction,
     isMarkAsClosedAction,
     isModifiedExpenseAction,
@@ -447,9 +445,6 @@ function computeReportNameBasedOnReportAction(
     if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED_TRANSACTION_MARKASRESOLVED) {
         return translate('iou.reject.reportActions.markedAsResolved');
     }
-    if (isApprovedOrSubmittedReportAction(parentReportAction) || isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.REIMBURSED)) {
-        return getReportActionMessageText(parentReportAction);
-    }
     if (isReimbursementQueuedAction(parentReportAction)) {
         return getReimbursementQueuedActionMessage({
             reportAction: parentReportAction,
diff --git a/tests/utils/collections/reportActions.ts b/tests/utils/collections/reportActions.ts
index 4c10dc00056e..e39eafa38040 100644
--- a/tests/utils/collections/reportActions.ts
+++ b/tests/utils/collections/reportActions.ts
@@ -31,6 +31,7 @@ const deprecatedReportActions: ReportActionName[] = [
     CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED,
     CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED,
     CONST.REPORT.ACTIONS.TYPE.DONATION,
+    CONST.REPORT.ACTIONS.TYPE.REIMBURSED,
 ] as const;
 
 export default function createRandomReportAction(index: number): ReportAction {

From f08d7c9bc28be81bf1745164f4a855e2fa541e4b Mon Sep 17 00:00:00 2001
From: Shubham Agrawal <shubham.agra1206@gmail.com>
Date: Sat, 21 Mar 2026 12:49:18 +0530
Subject: [PATCH 3/4] Fixed edge cases

---
 src/libs/ReportActionsUtils.ts | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts
index 6da23b71f95d..5ec6b3182b05 100644
--- a/src/libs/ReportActionsUtils.ts
+++ b/src/libs/ReportActionsUtils.ts
@@ -2301,11 +2301,6 @@ function getReportActionMessageFragments(translate: LocalizedTranslate, action:
         return [{text: message, html: `<muted-text>${message}</muted-text>`, type: 'COMMENT'}];
     }
 
-    if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REIMBURSED)) {
-        const message = getReportActionMessageText(action);
-        return [{text: message, html: `<muted-text>${message}</muted-text>`, type: 'COMMENT'}];
-    }
-
     if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.RETRACTED)) {
         const message = translate('iou.retracted');
         return [{text: message, html: `<muted-text>${message}</muted-text>`, type: 'COMMENT'}];

From c17a13823a7da25385ed2ea99a91530a1d3e6c4a Mon Sep 17 00:00:00 2001
From: Shubham Agrawal <shubham.agra1206@gmail.com>
Date: Fri, 27 Mar 2026 10:57:04 +0530
Subject: [PATCH 4/4] Prettier

---
 src/libs/ReportNameUtils.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libs/ReportNameUtils.ts b/src/libs/ReportNameUtils.ts
index 16af77d39932..24d4ad2f52c7 100644
--- a/src/libs/ReportNameUtils.ts
+++ b/src/libs/ReportNameUtils.ts
@@ -47,8 +47,8 @@ import {
     getDismissedViolationMessageText,
     getDynamicExternalWorkflowApproveFailedActionMessage,
     getDynamicExternalWorkflowSubmitFailedActionMessage,
-    getForeignCurrencyDefaultTaxUpdateMessage,
     getExportIntegrationLastMessageText,
+    getForeignCurrencyDefaultTaxUpdateMessage,
     getForwardsToUpdateMessage,
     getIntegrationSyncFailedMessage,
     getInvoiceCompanyNameUpdateMessage,
