diff --git a/src/languages/en.ts b/src/languages/en.ts index 27c0a1025651..b2de34c391ff 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -918,6 +918,7 @@ const translations = { automaticallyApprovedAmount: ({amount}: ApprovedAmountParams) => `automatically approved ${amount} via workspace rules`, approvedAmount: ({amount}: ApprovedAmountParams) => `approved ${amount}`, + unapprovedAmount: ({amount}: UnapprovedParams) => `unapproved ${amount}`, automaticallyForwardedAmount: ({amount}: ForwardedAmountParams) => `automatically approved ${amount} via workspace rules`, forwardedAmount: ({amount}: ForwardedAmountParams) => `approved ${amount}`, @@ -4318,7 +4319,6 @@ 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}`, 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 6b8734bd37e2..f3e77042b750 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -912,6 +912,7 @@ const translations = { automaticallyApprovedAmount: ({amount}: ApprovedAmountParams) => `aprobado automáticamente ${amount} según las reglas del espacio de trabajo`, approvedAmount: ({amount}: ApprovedAmountParams) => `aprobó ${amount}`, + unapprovedAmount: ({amount}: UnapprovedParams) => `desaprobó ${amount}`, automaticallyForwardedAmount: ({amount}: ForwardedAmountParams) => `aprobado automáticamente ${amount} según las reglas del espacio de trabajo`, forwardedAmount: ({amount}: ForwardedAmountParams) => `aprobó ${amount}`, @@ -4364,7 +4365,6 @@ 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}`, 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 5560316d2ddd..f787e630ab0d 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -316,7 +316,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 b5674c19dd00..fbf2f3b94c7c 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -726,6 +726,8 @@ function getLastMessageTextForReport(report: OnyxEntry, lastActorDetails } else { 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 e67b1bdd7e0a..3b5e0a8eeaa3 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -171,6 +171,10 @@ function isApprovedAction(reportAction: OnyxInputOrEntry): reportA return isActionOfType(reportAction, 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 { return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.FORWARDED); } @@ -1865,6 +1869,7 @@ export { isSubmittedAction, isSubmittedAndClosedAction, isApprovedAction, + isUnapprovedAction, isForwardedAction, isWhisperActionTargetedToOthers, isTagModificationAction, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index e9108956cb1d..65574e49eb96 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3835,6 +3835,9 @@ function getReportName( } return getIOUApprovedMessage(parentReportAction); } + if (ReportActionsUtils.isUnapprovedAction(parentReportAction)) { + return getIOUUnapprovedMessage(parentReportAction); + } if (isChatThread(report)) { if (!isEmptyObject(parentReportAction) && ReportActionsUtils.isTransactionThread(parentReportAction)) { @@ -4559,6 +4562,7 @@ function getFormattedAmount(reportAction: ReportAction) { !ReportActionsUtils.isSubmittedAction(reportAction) && !ReportActionsUtils.isForwardedAction(reportAction) && !ReportActionsUtils.isApprovedAction(reportAction) && + !ReportActionsUtils.isUnapprovedAction(reportAction) && !ReportActionsUtils.isSubmittedAndClosedAction(reportAction) ) { return ''; @@ -4582,6 +4586,10 @@ function getReportAutomaticallyApprovedMessage(reportAction: ReportAction) { + return Localize.translateLocal('iou.unapprovedAmount', {amount: getFormattedAmount(reportAction)}); +} + function getIOUApprovedMessage(reportAction: ReportAction) { return Localize.translateLocal('iou.approvedAmount', {amount: getFormattedAmount(reportAction)}); } @@ -8201,6 +8209,7 @@ export { getIOUReportActionDisplayMessage, getIOUReportActionMessage, getReportAutomaticallyApprovedMessage, + getIOUUnapprovedMessage, getIOUApprovedMessage, getReportAutomaticallyForwardedMessage, getIOUForwardedMessage, diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 8223b80cf040..ff4fed10f09e 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -460,6 +460,8 @@ const ContextMenuActions: ContextMenuAction[] = [ } else { Clipboard.setString(ReportUtils.getIOUApprovedMessage(reportAction)); } + } 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 5d63b7a03952..f015e84d6223 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -657,6 +657,8 @@ function ReportActionItem({ } else { 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) {