From d172810cb6992d0a0ebe5e876670738653366571 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 27 Sep 2024 11:00:23 +0700 Subject: [PATCH 1/9] fix: Square bracket displayed in system message for unapproved expense report --- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- src/languages/params.ts | 2 +- src/libs/OptionsListUtils.ts | 4 ++-- src/libs/ReportActionsUtils.ts | 7 +++++++ src/libs/ReportUtils.ts | 18 ++++++++++++------ .../report/ContextMenu/ContextMenuActions.tsx | 4 ++-- src/pages/home/report/ReportActionItem.tsx | 4 ++-- 8 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 6a90b1f8302a..544811294025 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4237,7 +4237,7 @@ const translations = { unshare: ({to}: UnshareParams) => `removed user ${to}`, stripePaid: ({amount, currency}: StripePaidParams) => `paid ${currency}${amount}`, takeControl: `took control`, - unapproved: ({amount, currency}: UnapprovedParams) => `unapproved ${currency}${amount}`, + unapproved: ({amount}: UnapprovedParams) => `unapproved${amount}`, integrationSyncFailed: ({label, errorMessage}: IntegrationSyncFailedParams) => `failed to sync with ${label} ("${errorMessage}")`, addEmployee: ({email, role}: AddEmployeeParams) => `added ${email} as ${role === 'user' ? 'member' : 'admin'}`, updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `updated the role of ${email} from ${currentRole} to ${newRole}`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 8d8b33ca57dd..caff59987e85 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4291,7 +4291,7 @@ const translations = { unshare: ({to}: UnshareParams) => `usuario eliminado ${to}`, stripePaid: ({amount, currency}: StripePaidParams) => `pagado ${currency}${amount}`, takeControl: `tomó el control`, - unapproved: ({amount, currency}: UnapprovedParams) => `no aprobado ${currency}${amount}`, + unapproved: ({amount}: UnapprovedParams) => `no aprobado ${amount}`, integrationSyncFailed: ({label, errorMessage}: IntegrationSyncFailedParams) => `no se pudo sincronizar con ${label} ("${errorMessage}")`, addEmployee: ({email, role}: AddEmployeeParams) => `agregó a ${email} como ${role === 'user' ? 'miembro' : 'administrador'}`, updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => diff --git a/src/languages/params.ts b/src/languages/params.ts index 8ed122283064..30dc164b011f 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -321,7 +321,7 @@ type UnshareParams = {to: string}; type StripePaidParams = {amount: string; currency: string}; -type UnapprovedParams = {amount: string; currency: string}; +type UnapprovedParams = {amount: string}; type RemoveMembersWarningPrompt = { memberName: string; diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 51db5a693f91..a93c455e9b9c 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -662,8 +662,8 @@ function getLastMessageTextForReport(report: OnyxEntry, lastActorDetails lastMessageTextFromReport = TaskUtils.getTaskCreatedMessage(lastReportAction); } else if (ReportActionUtils.isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.SUBMITTED)) { lastMessageTextFromReport = ReportUtils.getIOUSubmittedMessage(lastReportAction); - } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED) { - lastMessageTextFromReport = ReportUtils.getIOUApprovedMessage(lastReportAction); + } else if (ReportActionUtils.isUnapprovedOrApprovedAction(lastReportAction)) { + lastMessageTextFromReport = ReportUtils.getIOUUnapprovedOrApprovedMessage(lastReportAction); } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) { lastMessageTextFromReport = ReportUtils.getIOUForwardedMessage(lastReportAction, report); } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) { diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 8d567509c90e..fda4a398557d 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -167,6 +167,12 @@ function isApprovedAction(reportAction: OnyxInputOrEntry): reportA return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.APPROVED); } +function isUnapprovedOrApprovedAction( + reportAction: OnyxInputOrEntry, +): reportAction is ReportAction { + return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.UNAPPROVED, CONST.REPORT.ACTIONS.TYPE.APPROVED); +} + function isForwardedAction(reportAction: OnyxInputOrEntry): reportAction is ReportAction { return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.FORWARDED); } @@ -1861,6 +1867,7 @@ export { isWhisperAction, isSubmittedAction, isApprovedAction, + isUnapprovedOrApprovedAction, isForwardedAction, isWhisperActionTargetedToOthers, isTagModificationAction, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 684274bc0079..057c03df085e 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3782,8 +3782,8 @@ function getReportName( if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) { return getRejectedReportMessage(); } - if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED) { - return getIOUApprovedMessage(parentReportAction); + if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED || parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.UNAPPROVED) { + return getIOUUnapprovedOrApprovedMessage(parentReportAction); } if (isChatThread(report)) { @@ -4502,7 +4502,7 @@ function buildOptimisticExpenseReport( } function getFormattedAmount(reportAction: ReportAction) { - if (!ReportActionsUtils.isSubmittedAction(reportAction) && !ReportActionsUtils.isForwardedAction(reportAction) && !ReportActionsUtils.isApprovedAction(reportAction)) { + if (!ReportActionsUtils.isSubmittedAction(reportAction) && !ReportActionsUtils.isForwardedAction(reportAction) && !ReportActionsUtils.isUnapprovedOrApprovedAction(reportAction)) { return ''; } const originalMessage = ReportActionsUtils.getOriginalMessage(reportAction); @@ -4518,8 +4518,14 @@ function getIOUSubmittedMessage(reportAction: ReportAction; } - } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED) { - children = ; + } else if (ReportActionsUtils.isUnapprovedOrApprovedAction(action)) { + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) { From c9b0f3fe88b3a85bd4ae57e5f9519504be9410ac Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 27 Sep 2024 14:12:45 +0700 Subject: [PATCH 2/9] fix: add space in translation --- src/languages/en.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 544811294025..acad8465d44b 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4237,7 +4237,7 @@ const translations = { unshare: ({to}: UnshareParams) => `removed user ${to}`, stripePaid: ({amount, currency}: StripePaidParams) => `paid ${currency}${amount}`, takeControl: `took control`, - unapproved: ({amount}: UnapprovedParams) => `unapproved${amount}`, + unapproved: ({amount}: UnapprovedParams) => `unapproved ${amount}`, integrationSyncFailed: ({label, errorMessage}: IntegrationSyncFailedParams) => `failed to sync with ${label} ("${errorMessage}")`, addEmployee: ({email, role}: AddEmployeeParams) => `added ${email} as ${role === 'user' ? 'member' : 'admin'}`, updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `updated the role of ${email} from ${currentRole} to ${newRole}`, From b8ed59088fb372bdc70c44129f6bb31361c9e2f2 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 8 Oct 2024 23:59:04 +0700 Subject: [PATCH 3/9] Using utils function --- src/libs/ReportUtils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index b802e2cb26d4..d8f60bbeba9d 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3827,7 +3827,8 @@ function getReportName( if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) { return getRejectedReportMessage(); } - if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED || parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.UNAPPROVED) { + + if (ReportActionsUtils.isUnapprovedOrApprovedAction(parentReportAction)) { return getIOUUnapprovedOrApprovedMessage(parentReportAction); } From 4b2b210f6e8c8d53a2982c3503bfe77ba5888a7a Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 9 Oct 2024 23:12:31 +0700 Subject: [PATCH 4/9] change es file --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index e900ccdd5f2f..057d62d0a4b8 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4338,7 +4338,7 @@ const translations = { unshare: ({to}: UnshareParams) => `usuario eliminado ${to}`, stripePaid: ({amount, currency}: StripePaidParams) => `pagado ${currency}${amount}`, takeControl: `tomó el control`, - unapproved: ({amount}: UnapprovedParams) => `no aprobado ${amount}`, + unapproved: ({amount}: UnapprovedParams) => `desaprobó ${amount}`, integrationSyncFailed: ({label, errorMessage}: IntegrationSyncFailedParams) => `no se pudo sincronizar con ${label} ("${errorMessage}")`, addEmployee: ({email, role}: AddEmployeeParams) => `agregó a ${email} como ${role === 'user' ? 'miembro' : 'administrador'}`, updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => From e35c4a93dcb3ef805d02cf6a1f79209e9d7430d4 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 11 Oct 2024 14:19:59 +0700 Subject: [PATCH 5/9] remove isUnapprovedOrApprovedAction and getIOUUnapprovedOrApprovedMessage --- src/libs/OptionsListUtils.ts | 10 +++--- src/libs/ReportActionsUtils.ts | 8 ++--- src/libs/ReportUtils.ts | 36 ++++++++++--------- .../report/ContextMenu/ContextMenuActions.tsx | 14 ++++---- src/pages/home/report/ReportActionItem.tsx | 8 +++-- 5 files changed, 40 insertions(+), 36 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 2297bbeabd45..fbf2f3b94c7c 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -719,13 +719,15 @@ function getLastMessageTextForReport(report: OnyxEntry, lastActorDetails } else { lastMessageTextFromReport = ReportUtils.getIOUSubmittedMessage(lastReportAction); } - } else if (ReportActionUtils.isUnapprovedOrApprovedAction(lastReportAction)) { - const wasAutoApproved = ReportActionUtils.isApprovedAction(lastReportAction) && ReportActionUtils.getOriginalMessage(lastReportAction)?.automaticAction; - if (wasAutoApproved) { + } else if (ReportActionUtils.isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.APPROVED)) { + const {automaticAction} = ReportActionUtils.getOriginalMessage(lastReportAction) ?? {}; + if (automaticAction) { lastMessageTextFromReport = ReportUtils.getReportAutomaticallyApprovedMessage(lastReportAction); } else { - lastMessageTextFromReport = ReportUtils.getIOUUnapprovedOrApprovedMessage(lastReportAction); + lastMessageTextFromReport = ReportUtils.getIOUApprovedMessage(lastReportAction); } + } else if (ReportActionUtils.isUnapprovedAction(lastReportAction)) { + lastMessageTextFromReport = ReportUtils.getIOUUnapprovedMessage(lastReportAction); } else if (ReportActionUtils.isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.FORWARDED)) { const {automaticAction} = ReportActionUtils.getOriginalMessage(lastReportAction) ?? {}; if (automaticAction) { diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index ff547ba6d7c5..3b5e0a8eeaa3 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -171,10 +171,8 @@ function isApprovedAction(reportAction: OnyxInputOrEntry): reportA return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.APPROVED); } -function isUnapprovedOrApprovedAction( - reportAction: OnyxInputOrEntry, -): reportAction is ReportAction { - return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.UNAPPROVED, CONST.REPORT.ACTIONS.TYPE.APPROVED); +function isUnapprovedAction(reportAction: OnyxInputOrEntry): reportAction is ReportAction { + return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.UNAPPROVED); } function isForwardedAction(reportAction: OnyxInputOrEntry): reportAction is ReportAction { @@ -1871,7 +1869,7 @@ export { isSubmittedAction, isSubmittedAndClosedAction, isApprovedAction, - isUnapprovedOrApprovedAction, + isUnapprovedAction, isForwardedAction, isWhisperActionTargetedToOthers, isTagModificationAction, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 9f56c85e6b88..7409357e0f11 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3828,14 +3828,16 @@ function getReportName( if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) { return getRejectedReportMessage(); } - if (ReportActionsUtils.isUnapprovedOrApprovedAction(parentReportAction)) { - if (ReportActionsUtils.isApprovedAction(parentReportAction)) { - const {automaticAction} = ReportActionsUtils.getOriginalMessage(parentReportAction) ?? {}; - if (automaticAction) { - return Parser.htmlToText(getReportAutomaticallyApprovedMessage(parentReportAction)); - } + if (ReportActionsUtils.isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.FORWARDED)) { + const {automaticAction} = ReportActionsUtils.getOriginalMessage(parentReportAction) ?? {}; + if (automaticAction) { + return Parser.htmlToText(getReportAutomaticallyForwardedMessage(parentReportAction, reportID)); } - return getIOUUnapprovedOrApprovedMessage(parentReportAction); + return getIOUForwardedMessage(parentReportAction, report); + } + + if (ReportActionsUtils.isUnapprovedAction(parentReportAction)) { + return getIOUUnapprovedMessage(parentReportAction); } if (isChatThread(report)) { @@ -4560,7 +4562,8 @@ function getFormattedAmount(reportAction: ReportAction) { if ( !ReportActionsUtils.isSubmittedAction(reportAction) && !ReportActionsUtils.isForwardedAction(reportAction) && - !ReportActionsUtils.isUnapprovedOrApprovedAction(reportAction) && + !ReportActionsUtils.isApprovedAction(reportAction) && + !ReportActionsUtils.isUnapprovedAction(reportAction) && !ReportActionsUtils.isSubmittedAndClosedAction(reportAction) ) { return ''; @@ -4580,14 +4583,12 @@ function getIOUSubmittedMessage(reportAction: ReportAction) { + return Localize.translateLocal('iou.unapprovedAmount', {amount: getFormattedAmount(reportAction)}); +} + +function getIOUApprovedMessage(reportAction: ReportAction) { + return Localize.translateLocal('iou.approvedAmount', {amount: getFormattedAmount(reportAction)}); } function getReportAutomaticallyApprovedMessage(reportAction: ReportAction) { @@ -8208,7 +8209,8 @@ export { getGroupChatName, getIOUReportActionDisplayMessage, getIOUReportActionMessage, - getIOUUnapprovedOrApprovedMessage, + getIOUUnapprovedMessage, + getIOUApprovedMessage, getReportAutomaticallyApprovedMessage, getReportAutomaticallyForwardedMessage, getIOUForwardedMessage, diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index af6c9881a76a..ff4fed10f09e 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -453,15 +453,15 @@ const ContextMenuActions: ContextMenuAction[] = [ } else { Clipboard.setString(ReportUtils.getIOUSubmittedMessage(reportAction)); } - } else if (ReportActionsUtils.isUnapprovedOrApprovedAction(reportAction)) { - const wasAutoApproved = ReportActionsUtils.isApprovedAction(reportAction) && ReportActionsUtils.getOriginalMessage(reportAction)?.automaticAction; - let displayMessage = ''; - if (wasAutoApproved) { - displayMessage = ReportUtils.getReportAutomaticallyApprovedMessage(reportAction); + } else if (ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.APPROVED)) { + const {automaticAction} = ReportActionsUtils.getOriginalMessage(reportAction) ?? {}; + if (automaticAction) { + setClipboardMessage(ReportUtils.getReportAutomaticallyApprovedMessage(reportAction)); } else { - displayMessage = ReportUtils.getIOUUnapprovedOrApprovedMessage(reportAction); + Clipboard.setString(ReportUtils.getIOUApprovedMessage(reportAction)); } - Clipboard.setString(displayMessage); + } else if (ReportActionsUtils.isUnapprovedAction(reportAction)) { + Clipboard.setString(ReportUtils.getIOUUnapprovedMessage(reportAction)); } else if (ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.FORWARDED)) { const {automaticAction} = ReportActionsUtils.getOriginalMessage(reportAction) ?? {}; if (automaticAction) { diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 997b22a32626..f015e84d6223 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -646,8 +646,8 @@ function ReportActionItem({ } else { children = ; } - } else if (ReportActionsUtils.isUnapprovedOrApprovedAction(action)) { - const wasAutoApproved = ReportActionsUtils.isApprovedAction(action) && ReportActionsUtils.getOriginalMessage(action)?.automaticAction; + } else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.APPROVED)) { + const wasAutoApproved = ReportActionsUtils.getOriginalMessage(action)?.automaticAction ?? false; if (wasAutoApproved) { children = ( @@ -655,8 +655,10 @@ function ReportActionItem({ ); } else { - children = ; + children = ; } + } else if (ReportActionsUtils.isUnapprovedAction(action)) { + children = ; } else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.FORWARDED)) { const wasAutoForwarded = ReportActionsUtils.getOriginalMessage(action)?.automaticAction ?? false; if (wasAutoForwarded) { From 01e156aab91d4e3a355f65b4f719fef2420955bc Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 11 Oct 2024 14:27:19 +0700 Subject: [PATCH 6/9] minor change --- src/languages/es.ts | 2 +- src/libs/ReportUtils.ts | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index bb7abe0c8633..498fb550e126 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4365,7 +4365,7 @@ const translations = { unshare: ({to}: UnshareParams) => `usuario eliminado ${to}`, stripePaid: ({amount, currency}: StripePaidParams) => `pagado ${currency}${amount}`, takeControl: `tomó el control`, - unapproved: ({amount}: UnapprovedParams) => `desaprobó ${amount}`, + unapproved: ({amount}: UnapprovedParams) => `no aprobado ${amount}`, integrationSyncFailed: ({label, errorMessage}: IntegrationSyncFailedParams) => `no se pudo sincronizar con ${label} ("${errorMessage}")`, addEmployee: ({email, role}: AddEmployeeParams) => `agregó a ${email} como ${role === 'user' ? 'miembro' : 'administrador'}`, updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 7409357e0f11..9552c5497fdb 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3825,17 +3825,16 @@ function getReportName( } return getIOUForwardedMessage(parentReportAction, report); } - if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) { - return getRejectedReportMessage(); - } - if (ReportActionsUtils.isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.FORWARDED)) { + if (ReportActionsUtils.isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.APPROVED)) { const {automaticAction} = ReportActionsUtils.getOriginalMessage(parentReportAction) ?? {}; if (automaticAction) { - return Parser.htmlToText(getReportAutomaticallyForwardedMessage(parentReportAction, reportID)); + return Parser.htmlToText(getReportAutomaticallyApprovedMessage(parentReportAction)); } - return getIOUForwardedMessage(parentReportAction, report); + return getIOUApprovedMessage(parentReportAction); + } + if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) { + return getRejectedReportMessage(); } - if (ReportActionsUtils.isUnapprovedAction(parentReportAction)) { return getIOUUnapprovedMessage(parentReportAction); } From 65550817e9ce8bd0e5de63b84d786ca44712fa5c Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 11 Oct 2024 14:34:06 +0700 Subject: [PATCH 7/9] minor change --- src/libs/ReportUtils.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 9552c5497fdb..65574e49eb96 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3825,6 +3825,9 @@ function getReportName( } return getIOUForwardedMessage(parentReportAction, report); } + if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) { + return getRejectedReportMessage(); + } if (ReportActionsUtils.isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.APPROVED)) { const {automaticAction} = ReportActionsUtils.getOriginalMessage(parentReportAction) ?? {}; if (automaticAction) { @@ -3832,9 +3835,6 @@ function getReportName( } return getIOUApprovedMessage(parentReportAction); } - if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) { - return getRejectedReportMessage(); - } if (ReportActionsUtils.isUnapprovedAction(parentReportAction)) { return getIOUUnapprovedMessage(parentReportAction); } @@ -4582,18 +4582,18 @@ function getIOUSubmittedMessage(reportAction: ReportAction) { + return Localize.translateLocal('iou.automaticallyApprovedAmount', {amount: getFormattedAmount(reportAction)}); +} + function getIOUUnapprovedMessage(reportAction: ReportAction) { return Localize.translateLocal('iou.unapprovedAmount', {amount: getFormattedAmount(reportAction)}); } -function getIOUApprovedMessage(reportAction: ReportAction) { +function getIOUApprovedMessage(reportAction: ReportAction) { return Localize.translateLocal('iou.approvedAmount', {amount: getFormattedAmount(reportAction)}); } -function getReportAutomaticallyApprovedMessage(reportAction: ReportAction) { - return Localize.translateLocal('iou.automaticallyApprovedAmount', {amount: getFormattedAmount(reportAction)}); -} - /** * We pass the reportID as older FORWARDED actions do not have the amount & currency stored in the message * so we retrieve the amount from the report instead @@ -8208,9 +8208,9 @@ export { getGroupChatName, getIOUReportActionDisplayMessage, getIOUReportActionMessage, + getReportAutomaticallyApprovedMessage, getIOUUnapprovedMessage, getIOUApprovedMessage, - getReportAutomaticallyApprovedMessage, getReportAutomaticallyForwardedMessage, getIOUForwardedMessage, getRejectedReportMessage, From 4c77d3adda31f0d074950ad045460b238245eddb Mon Sep 17 00:00:00 2001 From: nkdengineer <161821005+nkdengineer@users.noreply.github.com> Date: Fri, 11 Oct 2024 21:24:18 +0700 Subject: [PATCH 8/9] Update src/languages/en.ts Co-authored-by: DylanDylann <141406735+DylanDylann@users.noreply.github.com> --- src/languages/en.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 1f900baf263a..b2de34c391ff 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4319,7 +4319,6 @@ const translations = { unshare: ({to}: UnshareParams) => `removed user ${to}`, stripePaid: ({amount, currency}: StripePaidParams) => `paid ${currency}${amount}`, takeControl: `took control`, - unapproved: ({amount}: UnapprovedParams) => `unapproved ${amount}`, integrationSyncFailed: ({label, errorMessage}: IntegrationSyncFailedParams) => `failed to sync with ${label} ("${errorMessage}")`, addEmployee: ({email, role}: AddEmployeeParams) => `added ${email} as ${role === 'user' ? 'member' : 'admin'}`, updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `updated the role of ${email} from ${currentRole} to ${newRole}`, From 8bef74e7d490abc7441b497ed2aaaa040dae6318 Mon Sep 17 00:00:00 2001 From: nkdengineer <161821005+nkdengineer@users.noreply.github.com> Date: Fri, 11 Oct 2024 21:24:26 +0700 Subject: [PATCH 9/9] Update src/languages/es.ts Co-authored-by: DylanDylann <141406735+DylanDylann@users.noreply.github.com> --- src/languages/es.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 498fb550e126..f3e77042b750 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4365,7 +4365,6 @@ const translations = { unshare: ({to}: UnshareParams) => `usuario eliminado ${to}`, stripePaid: ({amount, currency}: StripePaidParams) => `pagado ${currency}${amount}`, takeControl: `tomó el control`, - unapproved: ({amount}: UnapprovedParams) => `no aprobado ${amount}`, integrationSyncFailed: ({label, errorMessage}: IntegrationSyncFailedParams) => `no se pudo sincronizar con ${label} ("${errorMessage}")`, addEmployee: ({email, role}: AddEmployeeParams) => `agregó a ${email} como ${role === 'user' ? 'miembro' : 'administrador'}`, updateRole: ({email, currentRole, newRole}: UpdateRoleParams) =>