From 1f35f3b917780c9883acd8cb549cf60e5511ad70 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Tue, 4 Jun 2024 12:16:23 +0200 Subject: [PATCH 01/26] translations wip --- .env.production | 2 +- ios/Podfile.lock | 6 +-- src/CONST.ts | 10 ++-- src/languages/en.ts | 46 +++++++++++++++++ src/languages/es.ts | 46 +++++++++++++++++ src/languages/types.ts | 30 ++++++++++++ src/libs/ReportActionsUtils.ts | 57 +++++++++++++++++++++- src/pages/home/report/ReportActionItem.tsx | 2 +- 8 files changed, 187 insertions(+), 12 deletions(-) diff --git a/.env.production b/.env.production index 4b0a98e77557a..0845fc9088a3e 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,4 @@ -NEW_EXPENSIFY_URL=https://new.expensify.com/ +NEW_EXPENSIFY_URL=https://expensify.com/ SECURE_EXPENSIFY_URL=https://secure.expensify.com/ EXPENSIFY_URL=https://www.expensify.com/ EXPENSIFY_PARTNER_NAME=chat-expensify-com diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1ea6b65a58b72..eee5c82f82ae7 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1942,7 +1942,7 @@ PODS: - React-Codegen - React-Core - ReactCommon/turbomodule/core - - RNReanimated (3.7.2): + - RNReanimated (3.8.1): - glog - hermes-engine - RCT-Folly (= 2022.05.16.00) @@ -2594,7 +2594,7 @@ SPEC CHECKSUMS: rnmapbox-maps: df8fe93dbd251f25022f4023d31bc04160d4d65c RNPermissions: 0b61d30d21acbeafe25baaa47d9bae40a0c65216 RNReactNativeHapticFeedback: 616c35bdec7d20d4c524a7949ca9829c09e35f37 - RNReanimated: 51db0fff543694d931bd3b7cab1a3b36bd86c738 + RNReanimated: 323436b1a5364dca3b5f8b1a13458455e0de9efe RNScreens: 9ec969a95987a6caae170ef09313138abf3331e1 RNShare: 2a4cdfc0626ad56b0ef583d424f2038f772afe58 RNSound: 6c156f925295bdc83e8e422e7d8b38d33bc71852 @@ -2606,7 +2606,7 @@ SPEC CHECKSUMS: SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Turf: 13d1a92d969ca0311bbc26e8356cca178ce95da2 VisionCamera: 1394a316c7add37e619c48d7aa40b38b954bf055 - Yoga: 64cd2a583ead952b0315d5135bf39e053ae9be70 + Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312 PODFILE CHECKSUM: 66a5c97ae1059e4da1993a4ad95abe5d819f555b diff --git a/src/CONST.ts b/src/CONST.ts index de4e3305eddc9..3f6d6d2bb80f1 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -658,9 +658,9 @@ const CONST = { CLOSED: 'CLOSED', CREATED: 'CREATED', DELEGATE_SUBMIT: 'DELEGATESUBMIT', // OldDot Action - DELETED_ACCOUNT: 'DELETEDACCOUNT', // OldDot Action + DELETED_ACCOUNT: 'DELETEDACCOUNT', // Deprecated OldDot Action DISMISSED_VIOLATION: 'DISMISSEDVIOLATION', - DONATION: 'DONATION', // OldDot Action + DONATION: 'DONATION', // Deprecated OldDot Action EXPORTED_TO_CSV: 'EXPORTCSV', // OldDot Action EXPORTED_TO_INTEGRATION: 'EXPORTINTEGRATION', // OldDot Action EXPORTED_TO_QUICK_BOOKS: 'EXPORTED', // OldDot Action @@ -683,9 +683,9 @@ const CONST = { REIMBURSEMENT_DELAYED: 'REIMBURSEMENTDELAYED', // OldDot Action REIMBURSEMENT_QUEUED: 'REIMBURSEMENTQUEUED', REIMBURSEMENT_DEQUEUED: 'REIMBURSEMENTDEQUEUED', - REIMBURSEMENT_REQUESTED: 'REIMBURSEMENTREQUESTED', // OldDot Action - REIMBURSEMENT_SETUP: 'REIMBURSEMENTSETUP', // OldDot Action - REIMBURSEMENT_SETUP_REQUESTED: 'REIMBURSEMENTSETUPREQUESTED', // OldDot Action + REIMBURSEMENT_REQUESTED: 'REIMBURSEMENTREQUESTED', // Deprecated OldDot Action + REIMBURSEMENT_SETUP: 'REIMBURSEMENTSETUP', // Deprecated OldDot Action + REIMBURSEMENT_SETUP_REQUESTED: 'REIMBURSEMENTSETUPREQUESTED', // Deprecated OldDot Action RENAMED: 'RENAMED', REPORT_PREVIEW: 'REPORTPREVIEW', SELECTED_FOR_RANDOM_AUDIT: 'SELECTEDFORRANDOMAUDIT', // OldDot Action diff --git a/src/languages/en.ts b/src/languages/en.ts index 59f5a8ce869d3..0d3463a2c0a0a 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -13,10 +13,12 @@ import type { BeginningOfChatHistoryAnnounceRoomPartTwo, BeginningOfChatHistoryDomainRoomPartOneParams, CanceledRequestParams, + ChangeFieldParams, CharacterLimitParams, ConfirmThatParams, DateShouldBeAfterParams, DateShouldBeBeforeParams, + DelegateSubmitParams, DeleteActionParams, DeleteConfirmationParams, DidSplitAmountMessageParams, @@ -25,14 +27,18 @@ import type { ElectronicFundsParams, EnterMagicCodeParams, FormattedMaxLengthParams, + ForwardedParams, GoBackMessageParams, GoToRoomParams, InstantSummaryParams, + IntegrationsMessageParams, LocalTimeParams, LoggedInAsParams, LogSizeParams, ManagerApprovedAmountParams, ManagerApprovedParams, + MarkedReimbursedParams, + ModifyExpenseParams, NewFaceEnterMagicCodeParams, NoLongerHaveAccessParams, NotAllowedExtensionParams, @@ -49,6 +55,7 @@ import type { PayerPaidParams, PayerSettledParams, PaySomeoneParams, + ReimbursementDelayedParams, ReimbursementRateParams, RemovedTheRequestParams, RenamedRoomActionParams, @@ -66,9 +73,11 @@ import type { SetTheRequestParams, SettledAfterAddedBankAccountParams, SettleExpensifyCardParams, + ShareParams, SizeExceededParams, SplitAmountParams, StepCounterParams, + StripePaidParams, TaskCreatedActionParams, TermsParams, ThreadRequestReportNameParams, @@ -76,6 +85,7 @@ import type { ToValidateLoginParams, TransferParams, TranslationBase, + UnapprovedParams, UntilTimeParams, UpdatedTheDistanceParams, UpdatedTheRequestParams, @@ -2837,6 +2847,42 @@ export default { genericUpdateReportFieldFailureMessage: 'Unexpected error while updating the field, please try again later.', genericUpdateReporNameEditFailureMessage: 'Unexpected error while renaming the report, please try again later.', noActivityYet: 'No activity yet', + actions: { + type: { + changeField: ({value, oldValue, fieldName}: ChangeFieldParams) => `changed ${fieldName} from ${oldValue} to ${value}`, + changePolicy: ({value, oldValue}: ModifyExpenseParams) => `changed policy from ${oldValue} to ${value}`, + changeType: ({value, oldValue}: ModifyExpenseParams) => `changed type from ${oldValue} to ${value}`, + delegateSubmit: ({delegateUser, targetUser}: DelegateSubmitParams) => `sent this report to ${delegateUser} since ${targetUser} is on vacation`, + + // Skip + deletedAccount: ``, + donation: ``, + reimbursementSetup: ``, + reimbursementRequested: ``, + reimbursementSetupRequested: ``, + + exportedToCSV: `exported this report to CSV`, + exportedToIntegration: `exported this report to Integration`, + exportedToQuickBooks: `exported this report to QuickBooks`, + forwarded: ({amount}: ForwardedParams) => `approved ${amount}`, + integrationsMessage: ({errorMessage}: IntegrationsMessageParams) => `failed to export this report to NetSuite. ${errorMessage}`, + managerAttachReceipt: `added a receipt`, + managerDetachReceipt: `removed the receipt`, + markedReimbursed: ({amount}: MarkedReimbursedParams) => `paid ${amount} elsewhere`, + markedReimbursedFromIntegration: ({amount}: MarkedReimbursedParams) => `paid ${amount} via integration`, + outdatedBankAccount: `couldn’t process the payment due to a problem with the payer’s bank account`, + reimbursementACHBounce: `couldn’t process the payment, as the payer doesn’t have sufficient funds`, + reimbursementACHCancelled: `canceled the payment`, + reimbursementAccountChanged: `couldn’t process the payment, as the payer changed bank accounts`, + reimbursementDelayed: ({delayReason}: ReimbursementDelayedParams) => `delayed payment up to two business day due to ${delayReason}`, + selectedForRandomAudit: `[randomly selected](https://help.expensify.com/articles/expensify-classic/reports/Set-a-random-report-audit-schedule) for review`, + share: ({user}: ShareParams) => `invited user ${user}`, + unshare: ({user}: ShareParams) => `invited user ${user}`, + stripePaid: ({amount}: StripePaidParams) => `paid ${amount}`, + takeControl: `took control`, + unapproved: ({amount}: UnapprovedParams) => `unapproved ${amount}`, + }, + }, }, chronos: { oooEventSummaryFullDay: ({summary, dayCount, date}: OOOEventSummaryFullDayParams) => `${summary} for ${dayCount} ${dayCount === 1 ? 'day' : 'days'} until ${date}`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 3eba60c5ef8e9..4b89f17909f7d 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -11,10 +11,12 @@ import type { BeginningOfChatHistoryAnnounceRoomPartTwo, BeginningOfChatHistoryDomainRoomPartOneParams, CanceledRequestParams, + ChangeFieldParams, CharacterLimitParams, ConfirmThatParams, DateShouldBeAfterParams, DateShouldBeBeforeParams, + DelegateSubmitParams, DeleteActionParams, DeleteConfirmationParams, DidSplitAmountMessageParams, @@ -24,14 +26,18 @@ import type { EnglishTranslation, EnterMagicCodeParams, FormattedMaxLengthParams, + ForwardedParams, GoBackMessageParams, GoToRoomParams, InstantSummaryParams, + IntegrationsMessageParams, LocalTimeParams, LoggedInAsParams, LogSizeParams, ManagerApprovedAmountParams, ManagerApprovedParams, + MarkedReimbursedParams, + ModifyExpenseParams, NewFaceEnterMagicCodeParams, NoLongerHaveAccessParams, NotAllowedExtensionParams, @@ -48,6 +54,7 @@ import type { PayerPaidParams, PayerSettledParams, PaySomeoneParams, + ReimbursementDelayedParams, ReimbursementRateParams, RemovedTheRequestParams, RenamedRoomActionParams, @@ -65,15 +72,18 @@ import type { SetTheRequestParams, SettledAfterAddedBankAccountParams, SettleExpensifyCardParams, + ShareParams, SizeExceededParams, SplitAmountParams, StepCounterParams, + StripePaidParams, TaskCreatedActionParams, TermsParams, ThreadRequestReportNameParams, ThreadSentMoneyReportNameParams, ToValidateLoginParams, TransferParams, + UnapprovedParams, UntilTimeParams, UpdatedTheDistanceParams, UpdatedTheRequestParams, @@ -2879,6 +2889,42 @@ export default { genericUpdateReportFieldFailureMessage: 'Error inesperado al actualizar el campo. Por favor, inténtalo más tarde.', genericUpdateReporNameEditFailureMessage: 'Error inesperado al cambiar el nombre del informe. Vuelva a intentarlo más tarde.', noActivityYet: 'Sin actividad todavía', + actions: { + type: { + changeField: ({value, oldValue, fieldName}: ChangeFieldParams) => `changed ${fieldName} from ${oldValue} to ${value}`, + changePolicy: ({value, oldValue}: ModifyExpenseParams) => `changed policy from ${oldValue} to ${value}`, + changeType: ({value, oldValue}: ModifyExpenseParams) => `changed type from ${oldValue} to ${value}`, + delegateSubmit: ({delegateUser, targetUser}: DelegateSubmitParams) => `sent this report to ${delegateUser} since ${targetUser} is on vacation`, + + // Skip + deletedAccount: ``, + donation: ``, + reimbursementSetup: ``, + reimbursementRequested: ``, + reimbursementSetupRequested: ``, + + exportedToCSV: `exported this report to CSV`, + exportedToIntegration: `exported this report to Integration`, + exportedToQuickBooks: `exported this report to QuickBooks`, + forwarded: ({amount}: ForwardedParams) => `approved ${amount}`, + integrationsMessage: ({errorMessage}: IntegrationsMessageParams) => `failed to export this report to NetSuite. ${errorMessage}`, + managerAttachReceipt: `added a receipt`, + managerDetachReceipt: `removed the receipt`, + markedReimbursed: ({amount}: MarkedReimbursedParams) => `paid ${amount} elsewhere`, + markedReimbursedFromIntegration: ({amount}: MarkedReimbursedParams) => `paid ${amount} via integration`, + outdatedBankAccount: `couldn’t process the payment due to a problem with the payer’s bank account`, + reimbursementACHBounce: `couldn’t process the payment, as the payer doesn’t have sufficient funds`, + reimbursementACHCancelled: `canceled the payment`, + reimbursementAccountChanged: `couldn’t process the payment, as the payer changed bank accounts`, + reimbursementDelayed: ({delayReason}: ReimbursementDelayedParams) => `delayed payment up to two business day due to ${delayReason}`, + selectedForRandomAudit: `[randomly selected](https://help.expensify.com/articles/expensify-classic/reports/Set-a-random-report-audit-schedule) for review`, + share: ({user}: ShareParams) => `invited user ${user}`, + unshare: ({user}: ShareParams) => `invited user ${user}`, + stripePaid: ({amount}: StripePaidParams) => `paid ${amount}`, + takeControl: `took control`, + unapproved: ({amount}: UnapprovedParams) => `unapproved ${amount}`, + }, + }, }, chronos: { oooEventSummaryFullDay: ({summary, dayCount, date}: OOOEventSummaryFullDayParams) => `${summary} por ${dayCount} ${dayCount === 1 ? 'día' : 'días'} hasta el ${date}`, diff --git a/src/languages/types.ts b/src/languages/types.ts index e2e7e26e696b2..3a5c984e5d370 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -298,6 +298,26 @@ type DistanceRateOperationsParams = {count: number}; type ReimbursementRateParams = {unit: Unit}; +type ModifyExpenseParams = {oldValue: string; value: string}; + +type ChangeFieldParams = ModifyExpenseParams & {fieldName: string}; + +type DelegateSubmitParams = {delegateUser: string; targetUser: string}; + +type ForwardedParams = {amount: string}; + +type IntegrationsMessageParams = {errorMessage: string}; + +type MarkedReimbursedParams = {amount: string}; + +type ReimbursementDelayedParams = {delayReason: string}; + +type ShareParams = {user: string}; + +type StripePaidParams = {amount: string}; + +type UnapprovedParams = {amount: string}; + export type { AdminCanceledRequestParams, ApprovedAmountParams, @@ -402,4 +422,14 @@ export type { HeldRequestParams, PaySomeoneParams, ReimbursementRateParams, + ModifyExpenseParams, + ChangeFieldParams, + DelegateSubmitParams, + ForwardedParams, + IntegrationsMessageParams, + MarkedReimbursedParams, + ReimbursementDelayedParams, + ShareParams, + StripePaidParams, + UnapprovedParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 75d8e22ac9753..c27477eaafc2b 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1098,8 +1098,61 @@ function isOldDotReportAction(action: ReportAction): boolean { * Helper method to format message of OldDot Actions. * For now, we just concat all of the text elements of the message to create the full message. */ -function getMessageOfOldDotReportAction(reportAction: OnyxEntry): string { - return reportAction?.message?.map((element) => element?.text).join('') ?? ''; +function getMessageOfOldDotReportAction(action: ReportAction, actionName: ActionName): string { + console.log('ACTION ', action); + + switch (actionName) { + case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: + return Localize.translateLocal('report.actions.type.changeField', {value: '', oldValue: '', fieldName: ''}); + case CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY: + return Localize.translateLocal('report.actions.type.changePolicy', {}); + case CONST.REPORT.ACTIONS.TYPE.CHANGE_TYPE: + return Localize.translateLocal('report.actions.type.changeType', {}); + case CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT: + return Localize.translateLocal('report.actions.type.delegateSubmit', {}); + case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV: + return Localize.translateLocal('report.actions.type.exportedToCSV', {}); + case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION: + return Localize.translateLocal('report.actions.type.exportedToIntegration', {}); + case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_QUICK_BOOKS: + return Localize.translateLocal('report.actions.type.exportedToQuickBooks', {}); + case CONST.REPORT.ACTIONS.TYPE.FORWARDED: + return Localize.translateLocal('report.actions.type.forwarded', {}); + case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: + return Localize.translateLocal('report.actions.type.integrationsMessage', {}); + case CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT: + return Localize.translateLocal('report.actions.type.managerAttachReceipt', {}); + case CONST.REPORT.ACTIONS.TYPE.MANAGER_DETACH_RECEIPT: + return Localize.translateLocal('report.actions.type.managerDetachReceipt', {}); + case CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED: + return Localize.translateLocal('report.actions.type.markedReimbursed', {}); + case CONST.REPORT.ACTIONS.TYPE.MARK_REIMBURSED_FROM_INTEGRATION: + return Localize.translateLocal('report.actions.type.markedReimbursedFromIntegration', {}); + case CONST.REPORT.ACTIONS.TYPE.OUTDATED_BANK_ACCOUNT: + return Localize.translateLocal('report.actions.type.outdatedBankAccount', {}); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_BOUNCE: + return Localize.translateLocal('report.actions.type.reimbursementACHBounce', {}); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_CANCELLED: + return Localize.translateLocal('report.actions.type.reimbursementACHCancelled', {}); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACCOUNT_CHANGED: + return Localize.translateLocal('report.actions.type.reimbursementACHCancelled', {}); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DELAYED: + return Localize.translateLocal('report.actions.type.reimbursementDelayed', {}); + case CONST.REPORT.ACTIONS.TYPE.SELECTED_FOR_RANDOM_AUDIT: + return Localize.translateLocal('report.actions.type.selectedForRandomAudit', {}); + case CONST.REPORT.ACTIONS.TYPE.SHARE: + return Localize.translateLocal('report.actions.type.share', {}); + case CONST.REPORT.ACTIONS.TYPE.UNSHARE: + return Localize.translateLocal('report.actions.type.unshare', {}); + case CONST.REPORT.ACTIONS.TYPE.STRIPE_PAID: + return Localize.translateLocal('report.actions.type.stripePaid', {}); + case CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL: + return Localize.translateLocal('report.actions.type.takeControl', {}); + case CONST.REPORT.ACTIONS.TYPE.UNAPPROVED: + return Localize.translateLocal('report.actions.type.unapproved', {}); + default: + return ''; + } } function getMemberChangeMessagePlainText(reportAction: OnyxEntry): string { diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 4b248bf14131e..8334a761725e1 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -618,7 +618,7 @@ function ReportActionItem({ children = ; } else if (ReportActionsUtils.isOldDotReportAction(action)) { // This handles all historical actions from OldDot that we just want to display the message text - children = ; + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD_COMMENT) { From 6df91bb05133e9096f1822bd48a98568b3a695dd Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Wed, 5 Jun 2024 00:29:09 +0200 Subject: [PATCH 02/26] adjust params, cleanup --- .env.production | 2 +- src/CONST.ts | 5 -- src/languages/en.ts | 22 +++----- src/languages/es.ts | 22 +++----- src/languages/types.ts | 10 ++-- src/libs/ReportActionsUtils.ts | 91 ++++++++++++++++++++-------------- src/libs/ReportUtils.ts | 25 +++++++++- 7 files changed, 99 insertions(+), 78 deletions(-) diff --git a/.env.production b/.env.production index 0845fc9088a3e..4b0a98e77557a 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,4 @@ -NEW_EXPENSIFY_URL=https://expensify.com/ +NEW_EXPENSIFY_URL=https://new.expensify.com/ SECURE_EXPENSIFY_URL=https://secure.expensify.com/ EXPENSIFY_URL=https://www.expensify.com/ EXPENSIFY_PARTNER_NAME=chat-expensify-com diff --git a/src/CONST.ts b/src/CONST.ts index 3f6d6d2bb80f1..c6295293f2f09 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -658,9 +658,7 @@ const CONST = { CLOSED: 'CLOSED', CREATED: 'CREATED', DELEGATE_SUBMIT: 'DELEGATESUBMIT', // OldDot Action - DELETED_ACCOUNT: 'DELETEDACCOUNT', // Deprecated OldDot Action DISMISSED_VIOLATION: 'DISMISSEDVIOLATION', - DONATION: 'DONATION', // Deprecated OldDot Action EXPORTED_TO_CSV: 'EXPORTCSV', // OldDot Action EXPORTED_TO_INTEGRATION: 'EXPORTINTEGRATION', // OldDot Action EXPORTED_TO_QUICK_BOOKS: 'EXPORTED', // OldDot Action @@ -683,9 +681,6 @@ const CONST = { REIMBURSEMENT_DELAYED: 'REIMBURSEMENTDELAYED', // OldDot Action REIMBURSEMENT_QUEUED: 'REIMBURSEMENTQUEUED', REIMBURSEMENT_DEQUEUED: 'REIMBURSEMENTDEQUEUED', - REIMBURSEMENT_REQUESTED: 'REIMBURSEMENTREQUESTED', // Deprecated OldDot Action - REIMBURSEMENT_SETUP: 'REIMBURSEMENTSETUP', // Deprecated OldDot Action - REIMBURSEMENT_SETUP_REQUESTED: 'REIMBURSEMENTSETUPREQUESTED', // Deprecated OldDot Action RENAMED: 'RENAMED', REPORT_PREVIEW: 'REPORTPREVIEW', SELECTED_FOR_RANDOM_AUDIT: 'SELECTEDFORRANDOMAUDIT', // OldDot Action diff --git a/src/languages/en.ts b/src/languages/en.ts index 0d3463a2c0a0a..28ae67ea4e722 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2852,24 +2852,16 @@ export default { changeField: ({value, oldValue, fieldName}: ChangeFieldParams) => `changed ${fieldName} from ${oldValue} to ${value}`, changePolicy: ({value, oldValue}: ModifyExpenseParams) => `changed policy from ${oldValue} to ${value}`, changeType: ({value, oldValue}: ModifyExpenseParams) => `changed type from ${oldValue} to ${value}`, - delegateSubmit: ({delegateUser, targetUser}: DelegateSubmitParams) => `sent this report to ${delegateUser} since ${targetUser} is on vacation`, - - // Skip - deletedAccount: ``, - donation: ``, - reimbursementSetup: ``, - reimbursementRequested: ``, - reimbursementSetupRequested: ``, - + delegateSubmit: ({delegateUser, awayUser}: DelegateSubmitParams) => `sent this report to ${delegateUser} since ${awayUser} is on vacation`, exportedToCSV: `exported this report to CSV`, exportedToIntegration: `exported this report to Integration`, exportedToQuickBooks: `exported this report to QuickBooks`, - forwarded: ({amount}: ForwardedParams) => `approved ${amount}`, + forwarded: ({amount, currency}: ForwardedParams) => `approved ${currency}${amount}`, integrationsMessage: ({errorMessage}: IntegrationsMessageParams) => `failed to export this report to NetSuite. ${errorMessage}`, managerAttachReceipt: `added a receipt`, managerDetachReceipt: `removed the receipt`, - markedReimbursed: ({amount}: MarkedReimbursedParams) => `paid ${amount} elsewhere`, - markedReimbursedFromIntegration: ({amount}: MarkedReimbursedParams) => `paid ${amount} via integration`, + markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `paid ${currency}${amount} elsewhere`, + markedReimbursedFromIntegration: ({amount, currency}: MarkedReimbursedParams) => `paid ${currency}${amount} via integration`, outdatedBankAccount: `couldn’t process the payment due to a problem with the payer’s bank account`, reimbursementACHBounce: `couldn’t process the payment, as the payer doesn’t have sufficient funds`, reimbursementACHCancelled: `canceled the payment`, @@ -2877,10 +2869,10 @@ export default { reimbursementDelayed: ({delayReason}: ReimbursementDelayedParams) => `delayed payment up to two business day due to ${delayReason}`, selectedForRandomAudit: `[randomly selected](https://help.expensify.com/articles/expensify-classic/reports/Set-a-random-report-audit-schedule) for review`, share: ({user}: ShareParams) => `invited user ${user}`, - unshare: ({user}: ShareParams) => `invited user ${user}`, - stripePaid: ({amount}: StripePaidParams) => `paid ${amount}`, + unshare: ({user}: ShareParams) => `removed user ${user}`, + stripePaid: ({amount, currency}: StripePaidParams) => `paid ${currency}${amount}`, takeControl: `took control`, - unapproved: ({amount}: UnapprovedParams) => `unapproved ${amount}`, + unapproved: ({amount, currency}: UnapprovedParams) => `unapproved ${currency}${amount}`, }, }, }, diff --git a/src/languages/es.ts b/src/languages/es.ts index 4b89f17909f7d..49e37c57f957f 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2894,24 +2894,16 @@ export default { changeField: ({value, oldValue, fieldName}: ChangeFieldParams) => `changed ${fieldName} from ${oldValue} to ${value}`, changePolicy: ({value, oldValue}: ModifyExpenseParams) => `changed policy from ${oldValue} to ${value}`, changeType: ({value, oldValue}: ModifyExpenseParams) => `changed type from ${oldValue} to ${value}`, - delegateSubmit: ({delegateUser, targetUser}: DelegateSubmitParams) => `sent this report to ${delegateUser} since ${targetUser} is on vacation`, - - // Skip - deletedAccount: ``, - donation: ``, - reimbursementSetup: ``, - reimbursementRequested: ``, - reimbursementSetupRequested: ``, - + delegateSubmit: ({delegateUser, awayUser}: DelegateSubmitParams) => `sent this report to ${delegateUser} since ${awayUser} is on vacation`, exportedToCSV: `exported this report to CSV`, exportedToIntegration: `exported this report to Integration`, exportedToQuickBooks: `exported this report to QuickBooks`, - forwarded: ({amount}: ForwardedParams) => `approved ${amount}`, + forwarded: ({amount, currency}: ForwardedParams) => `approved ${currency}${amount}`, integrationsMessage: ({errorMessage}: IntegrationsMessageParams) => `failed to export this report to NetSuite. ${errorMessage}`, managerAttachReceipt: `added a receipt`, managerDetachReceipt: `removed the receipt`, - markedReimbursed: ({amount}: MarkedReimbursedParams) => `paid ${amount} elsewhere`, - markedReimbursedFromIntegration: ({amount}: MarkedReimbursedParams) => `paid ${amount} via integration`, + markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `paid ${currency}${amount} elsewhere`, + markedReimbursedFromIntegration: ({amount, currency}: MarkedReimbursedParams) => `paid ${currency}${amount} via integration`, outdatedBankAccount: `couldn’t process the payment due to a problem with the payer’s bank account`, reimbursementACHBounce: `couldn’t process the payment, as the payer doesn’t have sufficient funds`, reimbursementACHCancelled: `canceled the payment`, @@ -2919,10 +2911,10 @@ export default { reimbursementDelayed: ({delayReason}: ReimbursementDelayedParams) => `delayed payment up to two business day due to ${delayReason}`, selectedForRandomAudit: `[randomly selected](https://help.expensify.com/articles/expensify-classic/reports/Set-a-random-report-audit-schedule) for review`, share: ({user}: ShareParams) => `invited user ${user}`, - unshare: ({user}: ShareParams) => `invited user ${user}`, - stripePaid: ({amount}: StripePaidParams) => `paid ${amount}`, + unshare: ({user}: ShareParams) => `removed user ${user}`, + stripePaid: ({amount, currency}: StripePaidParams) => `paid ${currency}${amount}`, takeControl: `took control`, - unapproved: ({amount}: UnapprovedParams) => `unapproved ${amount}`, + unapproved: ({amount, currency}: UnapprovedParams) => `unapproved ${currency}${amount}`, }, }, }, diff --git a/src/languages/types.ts b/src/languages/types.ts index 3a5c984e5d370..cbddc28a1a4f9 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -302,21 +302,21 @@ type ModifyExpenseParams = {oldValue: string; value: string}; type ChangeFieldParams = ModifyExpenseParams & {fieldName: string}; -type DelegateSubmitParams = {delegateUser: string; targetUser: string}; +type DelegateSubmitParams = {delegateUser: string; awayUser: string}; -type ForwardedParams = {amount: string}; +type ForwardedParams = {amount: string; currency: string}; type IntegrationsMessageParams = {errorMessage: string}; -type MarkedReimbursedParams = {amount: string}; +type MarkedReimbursedParams = {amount: string; currency: string}; type ReimbursementDelayedParams = {delayReason: string}; type ShareParams = {user: string}; -type StripePaidParams = {amount: string}; +type StripePaidParams = {amount: string; currency: string}; -type UnapprovedParams = {amount: string}; +type UnapprovedParams = {amount: string; currency: string}; export type { AdminCanceledRequestParams, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index c27477eaafc2b..2ae1a36fde55c 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -31,6 +31,7 @@ import * as Localize from './Localize'; import Log from './Log'; import type {MessageElementBase, MessageTextElement} from './MessageElement'; import * as PersonalDetailsUtils from './PersonalDetailsUtils'; +import {getOriginalMessageModifiedField} from './ReportUtils'; import type {OptimisticIOUReportAction} from './ReportUtils'; import StringUtils from './StringUtils'; import * as TransactionUtils from './TransactionUtils'; @@ -1098,58 +1099,76 @@ function isOldDotReportAction(action: ReportAction): boolean { * Helper method to format message of OldDot Actions. * For now, we just concat all of the text elements of the message to create the full message. */ -function getMessageOfOldDotReportAction(action: ReportAction, actionName: ActionName): string { - console.log('ACTION ', action); - +function getMessageOfOldDotReportAction({originalMessage}: ReportAction, actionName: ActionName): string { switch (actionName) { - case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: - return Localize.translateLocal('report.actions.type.changeField', {value: '', oldValue: '', fieldName: ''}); - case CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY: - return Localize.translateLocal('report.actions.type.changePolicy', {}); - case CONST.REPORT.ACTIONS.TYPE.CHANGE_TYPE: - return Localize.translateLocal('report.actions.type.changeType', {}); - case CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT: - return Localize.translateLocal('report.actions.type.delegateSubmit', {}); + case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: { + const fieldName = getOriginalMessageModifiedField(action.originalMessage); + const {value, oldValue} = originalMessage; + + return Localize.translateLocal('report.actions.type.changeField', {value, oldValue, fieldName}); + } + case CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY: { + const {value, oldValue} = originalMessage; + return Localize.translateLocal('report.actions.type.changePolicy', {value, oldValue}); + } + case CONST.REPORT.ACTIONS.TYPE.CHANGE_TYPE: { + const {value, oldValue} = originalMessage; + return Localize.translateLocal('report.actions.type.changeType', {value, oldValue}); + } + case CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT: { + const {delegateUser, awayUser} = originalMessage; + return Localize.translateLocal('report.actions.type.delegateSubmit', {delegateUser, awayUser}); + } case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV: - return Localize.translateLocal('report.actions.type.exportedToCSV', {}); + return Localize.translateLocal('report.actions.type.exportedToCSV'); case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION: - return Localize.translateLocal('report.actions.type.exportedToIntegration', {}); + return Localize.translateLocal('report.actions.type.exportedToIntegration'); case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_QUICK_BOOKS: - return Localize.translateLocal('report.actions.type.exportedToQuickBooks', {}); - case CONST.REPORT.ACTIONS.TYPE.FORWARDED: - return Localize.translateLocal('report.actions.type.forwarded', {}); + return Localize.translateLocal('report.actions.type.exportedToQuickBooks'); + case CONST.REPORT.ACTIONS.TYPE.FORWARDED: { + const {amount, currency} = originalMessage; + return Localize.translateLocal('report.actions.type.forwarded', {amount, currency}); + } case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: - return Localize.translateLocal('report.actions.type.integrationsMessage', {}); + return Localize.translateLocal('report.actions.type.integrationsMessage', {errorMessage: originalMessage.errorMessage}); case CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT: - return Localize.translateLocal('report.actions.type.managerAttachReceipt', {}); + return Localize.translateLocal('report.actions.type.managerAttachReceipt'); case CONST.REPORT.ACTIONS.TYPE.MANAGER_DETACH_RECEIPT: - return Localize.translateLocal('report.actions.type.managerDetachReceipt', {}); - case CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED: - return Localize.translateLocal('report.actions.type.markedReimbursed', {}); - case CONST.REPORT.ACTIONS.TYPE.MARK_REIMBURSED_FROM_INTEGRATION: - return Localize.translateLocal('report.actions.type.markedReimbursedFromIntegration', {}); + return Localize.translateLocal('report.actions.type.managerDetachReceipt'); + case CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED: { + const {amount, currency} = originalMessage; + return Localize.translateLocal('report.actions.type.markedReimbursed', {amount, currency}); + } + case CONST.REPORT.ACTIONS.TYPE.MARK_REIMBURSED_FROM_INTEGRATION: { + const {amount, currency} = originalMessage; + return Localize.translateLocal('report.actions.type.markedReimbursedFromIntegration', {amount, currency}); + } case CONST.REPORT.ACTIONS.TYPE.OUTDATED_BANK_ACCOUNT: - return Localize.translateLocal('report.actions.type.outdatedBankAccount', {}); + return Localize.translateLocal('report.actions.type.outdatedBankAccount'); case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_BOUNCE: - return Localize.translateLocal('report.actions.type.reimbursementACHBounce', {}); + return Localize.translateLocal('report.actions.type.reimbursementACHBounce'); case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_CANCELLED: - return Localize.translateLocal('report.actions.type.reimbursementACHCancelled', {}); + return Localize.translateLocal('report.actions.type.reimbursementACHCancelled'); case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACCOUNT_CHANGED: - return Localize.translateLocal('report.actions.type.reimbursementACHCancelled', {}); + return Localize.translateLocal('report.actions.type.reimbursementAccountChanged'); case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DELAYED: - return Localize.translateLocal('report.actions.type.reimbursementDelayed', {}); + return Localize.translateLocal('report.actions.type.reimbursementDelayed', {delayReason: originalMessage.delayReason}); case CONST.REPORT.ACTIONS.TYPE.SELECTED_FOR_RANDOM_AUDIT: - return Localize.translateLocal('report.actions.type.selectedForRandomAudit', {}); + return Localize.translateLocal('report.actions.type.selectedForRandomAudit'); case CONST.REPORT.ACTIONS.TYPE.SHARE: - return Localize.translateLocal('report.actions.type.share', {}); + return Localize.translateLocal('report.actions.type.share', {user: originalMessage.invitedUser}); case CONST.REPORT.ACTIONS.TYPE.UNSHARE: - return Localize.translateLocal('report.actions.type.unshare', {}); - case CONST.REPORT.ACTIONS.TYPE.STRIPE_PAID: - return Localize.translateLocal('report.actions.type.stripePaid', {}); + return Localize.translateLocal('report.actions.type.unshare', {user: originalMessage.removedUser}); + case CONST.REPORT.ACTIONS.TYPE.STRIPE_PAID: { + const {amount, currency} = originalMessage; + return Localize.translateLocal('report.actions.type.stripePaid', {amount, currency}); + } case CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL: - return Localize.translateLocal('report.actions.type.takeControl', {}); - case CONST.REPORT.ACTIONS.TYPE.UNAPPROVED: - return Localize.translateLocal('report.actions.type.unapproved', {}); + return Localize.translateLocal('report.actions.type.takeControl'); + case CONST.REPORT.ACTIONS.TYPE.UNAPPROVED: { + const {amount, currency} = originalMessage; + return Localize.translateLocal('report.actions.type.unapproved', {amount, currency}); + } default: return ''; } diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 690cfdafd92df..3d2ab6383736c 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -51,7 +51,7 @@ import type { } from '@src/types/onyx/OriginalMessage'; import type {Status} from '@src/types/onyx/PersonalDetails'; import type {NotificationPreference, Participants, PendingChatMember, Participant as ReportParticipant} from '@src/types/onyx/Report'; -import type {Message, ReportActionBase, ReportActions, ReportPreviewAction} from '@src/types/onyx/ReportAction'; +import type {Message, OriginalMessage, ReportActionBase, ReportActions, ReportPreviewAction} from '@src/types/onyx/ReportAction'; import type {Comment, Receipt, TransactionChanges, WaypointCollection} from '@src/types/onyx/Transaction'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; @@ -3041,6 +3041,28 @@ function getModifiedExpenseOriginalMessage( return originalMessage; } +const ORIGINAL_MESSAGE_FIELDS = ['comment', 'created', 'merchant', 'amount', 'currency', 'category', 'tag', 'taxCode', 'taxAmount', 'billable'] as const; + +// /** +// * Detect and return a modified field name based on the original message. +// * +// * At the moment, we only allow changing one transaction field at a time. +// * @param originalMessage +// */ +function getOriginalMessageModifiedField({originalMessage}: OriginalMessage): string { + if (typeof originalMessage !== 'object' || originalMessage === null) { + return ''; + } + + for (const field of ORIGINAL_MESSAGE_FIELDS) { + if (field in originalMessage) { + return field; + } + } + + return ''; +} + /** * Check if original message is an object and can be used as a ChangeLog type * @param originalMessage @@ -7026,6 +7048,7 @@ export { isCurrentUserInvoiceReceiver, isDraftReport, createDraftWorkspaceAndNavigateToConfirmationScreen, + getOriginalMessageModifiedField, }; export type { From 0feb9d8199116bbaf3b54006e7c97fb0e454b629 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Wed, 5 Jun 2024 16:37:20 +0200 Subject: [PATCH 03/26] add spanish translations, update delayed message --- src/languages/en.ts | 3 +- src/languages/es.ts | 163 ++++++--------------------------- src/languages/types.ts | 3 - src/libs/ReportActionsUtils.ts | 2 +- 4 files changed, 29 insertions(+), 142 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 28ae67ea4e722..828ff021c621a 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -55,7 +55,6 @@ import type { PayerPaidParams, PayerSettledParams, PaySomeoneParams, - ReimbursementDelayedParams, ReimbursementRateParams, RemovedTheRequestParams, RenamedRoomActionParams, @@ -2866,7 +2865,7 @@ export default { reimbursementACHBounce: `couldn’t process the payment, as the payer doesn’t have sufficient funds`, reimbursementACHCancelled: `canceled the payment`, reimbursementAccountChanged: `couldn’t process the payment, as the payer changed bank accounts`, - reimbursementDelayed: ({delayReason}: ReimbursementDelayedParams) => `delayed payment up to two business day due to ${delayReason}`, + reimbursementDelayed: `processed the payment but it’s delayed by 1-2 more business days`, selectedForRandomAudit: `[randomly selected](https://help.expensify.com/articles/expensify-classic/reports/Set-a-random-report-audit-schedule) for review`, share: ({user}: ShareParams) => `invited user ${user}`, unshare: ({user}: ShareParams) => `removed user ${user}`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 49e37c57f957f..35d96466565e9 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1,117 +1,8 @@ import Str from 'expensify-common/lib/str'; import CONST from '@src/CONST'; -import type {ConnectionName, PolicyConnectionSyncStage} from '@src/types/onyx/Policy'; -import type { - AddressLineParams, - AdminCanceledRequestParams, - AlreadySignedInParams, - ApprovedAmountParams, - BeginningOfChatHistoryAdminRoomPartOneParams, - BeginningOfChatHistoryAnnounceRoomPartOneParams, - BeginningOfChatHistoryAnnounceRoomPartTwo, - BeginningOfChatHistoryDomainRoomPartOneParams, - CanceledRequestParams, - ChangeFieldParams, - CharacterLimitParams, - ConfirmThatParams, - DateShouldBeAfterParams, - DateShouldBeBeforeParams, - DelegateSubmitParams, - DeleteActionParams, - DeleteConfirmationParams, - DidSplitAmountMessageParams, - DistanceRateOperationsParams, - EditActionParams, - ElectronicFundsParams, - EnglishTranslation, - EnterMagicCodeParams, - FormattedMaxLengthParams, - ForwardedParams, - GoBackMessageParams, - GoToRoomParams, - InstantSummaryParams, - IntegrationsMessageParams, - LocalTimeParams, - LoggedInAsParams, - LogSizeParams, - ManagerApprovedAmountParams, - ManagerApprovedParams, - MarkedReimbursedParams, - ModifyExpenseParams, - NewFaceEnterMagicCodeParams, - NoLongerHaveAccessParams, - NotAllowedExtensionParams, - NotYouParams, - OOOEventSummaryFullDayParams, - OOOEventSummaryPartialDayParams, - OurEmailProviderParams, - PaidElsewhereWithAmountParams, - PaidWithExpensifyWithAmountParams, - ParentNavigationSummaryParams, - PayerOwesAmountParams, - PayerOwesParams, - PayerPaidAmountParams, - PayerPaidParams, - PayerSettledParams, - PaySomeoneParams, - ReimbursementDelayedParams, - ReimbursementRateParams, - RemovedTheRequestParams, - RenamedRoomActionParams, - ReportArchiveReasonsClosedParams, - ReportArchiveReasonsMergedParams, - ReportArchiveReasonsPolicyDeletedParams, - ReportArchiveReasonsRemovedFromPolicyParams, - RequestAmountParams, - RequestCountParams, - RequestedAmountMessageParams, - ResolutionConstraintsParams, - RoomNameReservedErrorParams, - RoomRenamedToParams, - SetTheDistanceParams, - SetTheRequestParams, - SettledAfterAddedBankAccountParams, - SettleExpensifyCardParams, - ShareParams, - SizeExceededParams, - SplitAmountParams, - StepCounterParams, - StripePaidParams, - TaskCreatedActionParams, - TermsParams, - ThreadRequestReportNameParams, - ThreadSentMoneyReportNameParams, - ToValidateLoginParams, - TransferParams, - UnapprovedParams, - UntilTimeParams, - UpdatedTheDistanceParams, - UpdatedTheRequestParams, - UsePlusButtonParams, - UserIsAlreadyMemberParams, - UserSplitParams, - ViolationsAutoReportedRejectedExpenseParams, - ViolationsCashExpenseWithNoReceiptParams, - ViolationsConversionSurchargeParams, - ViolationsInvoiceMarkupParams, - ViolationsMaxAgeParams, - ViolationsMissingTagParams, - ViolationsOverAutoApprovalLimitParams, - ViolationsOverCategoryLimitParams, - ViolationsOverLimitParams, - ViolationsPerDayLimitParams, - ViolationsReceiptRequiredParams, - ViolationsRterParams, - ViolationsTagOutOfPolicyParams, - ViolationsTaxOutOfPolicyParams, - WaitingOnBankAccountParams, - WalletProgramParams, - WelcomeEnterMagicCodeParams, - WelcomeNoteParams, - WelcomeToRoomParams, - WeSentYouMagicSignInLinkParams, - ZipCodeExampleFormatParams, -} from './types'; +import type { ConnectionName, PolicyConnectionSyncStage } from '@src/types/onyx/Policy'; +import type { AddressLineParams, AdminCanceledRequestParams, AlreadySignedInParams, ApprovedAmountParams, BeginningOfChatHistoryAdminRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartTwo, BeginningOfChatHistoryDomainRoomPartOneParams, CanceledRequestParams, ChangeFieldParams, CharacterLimitParams, ConfirmThatParams, DateShouldBeAfterParams, DateShouldBeBeforeParams, DelegateSubmitParams, DeleteActionParams, DeleteConfirmationParams, DidSplitAmountMessageParams, DistanceRateOperationsParams, EditActionParams, ElectronicFundsParams, EnglishTranslation, EnterMagicCodeParams, FormattedMaxLengthParams, ForwardedParams, GoBackMessageParams, GoToRoomParams, InstantSummaryParams, IntegrationsMessageParams, LocalTimeParams, LoggedInAsParams, LogSizeParams, ManagerApprovedAmountParams, ManagerApprovedParams, MarkedReimbursedParams, ModifyExpenseParams, NewFaceEnterMagicCodeParams, NoLongerHaveAccessParams, NotAllowedExtensionParams, NotYouParams, OOOEventSummaryFullDayParams, OOOEventSummaryPartialDayParams, OurEmailProviderParams, PaidElsewhereWithAmountParams, PaidWithExpensifyWithAmountParams, ParentNavigationSummaryParams, PayerOwesAmountParams, PayerOwesParams, PayerPaidAmountParams, PayerPaidParams, PayerSettledParams, PaySomeoneParams, ReimbursementDelayedParams, ReimbursementRateParams, RemovedTheRequestParams, RenamedRoomActionParams, ReportArchiveReasonsClosedParams, ReportArchiveReasonsMergedParams, ReportArchiveReasonsPolicyDeletedParams, ReportArchiveReasonsRemovedFromPolicyParams, RequestAmountParams, RequestCountParams, RequestedAmountMessageParams, ResolutionConstraintsParams, RoomNameReservedErrorParams, RoomRenamedToParams, SetTheDistanceParams, SetTheRequestParams, SettledAfterAddedBankAccountParams, SettleExpensifyCardParams, ShareParams, SizeExceededParams, SplitAmountParams, StepCounterParams, StripePaidParams, TaskCreatedActionParams, TermsParams, ThreadRequestReportNameParams, ThreadSentMoneyReportNameParams, ToValidateLoginParams, TransferParams, UnapprovedParams, UntilTimeParams, UpdatedTheDistanceParams, UpdatedTheRequestParams, UsePlusButtonParams, UserIsAlreadyMemberParams, UserSplitParams, ViolationsAutoReportedRejectedExpenseParams, ViolationsCashExpenseWithNoReceiptParams, ViolationsConversionSurchargeParams, ViolationsInvoiceMarkupParams, ViolationsMaxAgeParams, ViolationsMissingTagParams, ViolationsOverAutoApprovalLimitParams, ViolationsOverCategoryLimitParams, ViolationsOverLimitParams, ViolationsPerDayLimitParams, ViolationsReceiptRequiredParams, ViolationsRterParams, ViolationsTagOutOfPolicyParams, ViolationsTaxOutOfPolicyParams, WaitingOnBankAccountParams, WalletProgramParams, WelcomeEnterMagicCodeParams, WelcomeNoteParams, WelcomeToRoomParams, WeSentYouMagicSignInLinkParams, ZipCodeExampleFormatParams } from './types'; + /* eslint-disable max-len */ export default { @@ -2891,30 +2782,30 @@ export default { noActivityYet: 'Sin actividad todavía', actions: { type: { - changeField: ({value, oldValue, fieldName}: ChangeFieldParams) => `changed ${fieldName} from ${oldValue} to ${value}`, - changePolicy: ({value, oldValue}: ModifyExpenseParams) => `changed policy from ${oldValue} to ${value}`, - changeType: ({value, oldValue}: ModifyExpenseParams) => `changed type from ${oldValue} to ${value}`, - delegateSubmit: ({delegateUser, awayUser}: DelegateSubmitParams) => `sent this report to ${delegateUser} since ${awayUser} is on vacation`, - exportedToCSV: `exported this report to CSV`, - exportedToIntegration: `exported this report to Integration`, - exportedToQuickBooks: `exported this report to QuickBooks`, - forwarded: ({amount, currency}: ForwardedParams) => `approved ${currency}${amount}`, - integrationsMessage: ({errorMessage}: IntegrationsMessageParams) => `failed to export this report to NetSuite. ${errorMessage}`, - managerAttachReceipt: `added a receipt`, - managerDetachReceipt: `removed the receipt`, - markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `paid ${currency}${amount} elsewhere`, - markedReimbursedFromIntegration: ({amount, currency}: MarkedReimbursedParams) => `paid ${currency}${amount} via integration`, - outdatedBankAccount: `couldn’t process the payment due to a problem with the payer’s bank account`, - reimbursementACHBounce: `couldn’t process the payment, as the payer doesn’t have sufficient funds`, + changeField: ({value, oldValue, fieldName}: ChangeFieldParams) => `cambió ${fieldName} de ${oldValue} a ${value}`, + changePolicy: ({value, oldValue}: ModifyExpenseParams) => `cambió policy de ${oldValue} a ${value}`, + changeType: ({value, oldValue}: ModifyExpenseParams) => `cambió type de ${oldValue} a ${value}`, + delegateSubmit: ({delegateUser, awayUser}: DelegateSubmitParams) => `envié este informe a ${delegateUser} ya que ${awayUser} está de vacaciones`, + exportedToCSV: `exportó este informe a CSV`, + exportedToIntegration: `exportó este informe a Integration`, + exportedToQuickBooks: `exportó este informe a QuickBooks`, + forwarded: ({amount, currency}: ForwardedParams) => `aprobado ${currency}${amount}`, + integrationsMessage: ({errorMessage}: IntegrationsMessageParams) => `no se pudo exportar este informe a NetSuite. ${errorMessage}`, + managerAttachReceipt: `agregó un recibo`, + managerDetachReceipt: `quitó el recibo`, + markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `pagó ${currency}${amount} en otro lugar`, + markedReimbursedFromIntegration: ({amount, currency}: MarkedReimbursedParams) => `pagó ${currency}${amount} mediante integración`, + outdatedBankAccount: `no se pudo procesar el pago debido a un problema con la cuenta bancaria del pagador`, + reimbursementACHBounce: `no se pudo procesar el pago porque el pagador no tiene fondos suficientes`, reimbursementACHCancelled: `canceled the payment`, - reimbursementAccountChanged: `couldn’t process the payment, as the payer changed bank accounts`, - reimbursementDelayed: ({delayReason}: ReimbursementDelayedParams) => `delayed payment up to two business day due to ${delayReason}`, - selectedForRandomAudit: `[randomly selected](https://help.expensify.com/articles/expensify-classic/reports/Set-a-random-report-audit-schedule) for review`, - share: ({user}: ShareParams) => `invited user ${user}`, - unshare: ({user}: ShareParams) => `removed user ${user}`, - stripePaid: ({amount, currency}: StripePaidParams) => `paid ${currency}${amount}`, - takeControl: `took control`, - unapproved: ({amount, currency}: UnapprovedParams) => `unapproved ${currency}${amount}`, + reimbursementAccountChanged: `no se pudo procesar el pago porque el pagador cambió de cuenta bancaria`, + reimbursementDelayed: `procesó el pago pero se retrasó entre 1 y 2 días hábiles más`, + selectedForRandomAudit: `[seleccionado al azar](https://help.expensify.com/articles/expensify-classic/reports/Set-a-random-report-audit-schedule) para revisión`, + share: ({user}: ShareParams) => `usuario invitado ${user}`, + unshare: ({user}: ShareParams) => `usuario eliminado ${user}`, + stripePaid: ({amount, currency}: StripePaidParams) => `pagado ${currency}${amount}`, + takeControl: `tomó el control`, + unapproved: ({amount, currency}: UnapprovedParams) => `no aprobado ${currency}${amount}`, }, }, }, @@ -3687,4 +3578,4 @@ export default { systemMessage: { mergedWithCashTransaction: 'encontró un recibo para esta transacción.', }, -} satisfies EnglishTranslation; +} satisfies EnglishTranslation; \ No newline at end of file diff --git a/src/languages/types.ts b/src/languages/types.ts index cbddc28a1a4f9..82ffc0ebcac66 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -310,8 +310,6 @@ type IntegrationsMessageParams = {errorMessage: string}; type MarkedReimbursedParams = {amount: string; currency: string}; -type ReimbursementDelayedParams = {delayReason: string}; - type ShareParams = {user: string}; type StripePaidParams = {amount: string; currency: string}; @@ -428,7 +426,6 @@ export type { ForwardedParams, IntegrationsMessageParams, MarkedReimbursedParams, - ReimbursementDelayedParams, ShareParams, StripePaidParams, UnapprovedParams, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 2ae1a36fde55c..d4cd93827f248 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1152,7 +1152,7 @@ function getMessageOfOldDotReportAction({originalMessage}: ReportAction, actionN case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACCOUNT_CHANGED: return Localize.translateLocal('report.actions.type.reimbursementAccountChanged'); case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DELAYED: - return Localize.translateLocal('report.actions.type.reimbursementDelayed', {delayReason: originalMessage.delayReason}); + return Localize.translateLocal('report.actions.type.reimbursementDelayed'); case CONST.REPORT.ACTIONS.TYPE.SELECTED_FOR_RANDOM_AUDIT: return Localize.translateLocal('report.actions.type.selectedForRandomAudit'); case CONST.REPORT.ACTIONS.TYPE.SHARE: From 0566b14b38a83099cf2d08ae8842e3ab7a363b9d Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Mon, 17 Jun 2024 15:14:14 +0200 Subject: [PATCH 04/26] update messages wip --- src/languages/en.ts | 15 ++-- src/languages/es.ts | 127 ++++++++++++++++++++++++++++++--- src/languages/types.ts | 13 +++- src/libs/ReportActionsUtils.ts | 17 ++--- 4 files changed, 145 insertions(+), 27 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 828ff021c621a..9303a90fbef6c 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -14,6 +14,8 @@ import type { BeginningOfChatHistoryDomainRoomPartOneParams, CanceledRequestParams, ChangeFieldParams, + ChangePolicyParams, + ChangeTypeParams, CharacterLimitParams, ConfirmThatParams, DateShouldBeAfterParams, @@ -26,6 +28,7 @@ import type { EditActionParams, ElectronicFundsParams, EnterMagicCodeParams, + ExportedToIntegrationParams, FormattedMaxLengthParams, ForwardedParams, GoBackMessageParams, @@ -2848,14 +2851,14 @@ export default { noActivityYet: 'No activity yet', actions: { type: { - changeField: ({value, oldValue, fieldName}: ChangeFieldParams) => `changed ${fieldName} from ${oldValue} to ${value}`, - changePolicy: ({value, oldValue}: ModifyExpenseParams) => `changed policy from ${oldValue} to ${value}`, - changeType: ({value, oldValue}: ModifyExpenseParams) => `changed type from ${oldValue} to ${value}`, - delegateSubmit: ({delegateUser, awayUser}: DelegateSubmitParams) => `sent this report to ${delegateUser} since ${awayUser} is on vacation`, + changeField: ({oldValue, newValue, fieldName}: ChangeFieldParams) => `changed ${fieldName} from ${oldValue} to ${newValue}`, + changePolicy: ({fromPolicy, toPolicy}: ChangePolicyParams) => `changed policy from ${fromPolicy} to ${toPolicy}`, + changeType: ({oldType, newType}: ChangeTypeParams) => `changed type from ${oldType} to ${newType}`, + delegateSubmit: ({delegateUser, originalManager}: DelegateSubmitParams) => `sent this report to ${delegateUser} since ${originalManager} is on vacation`, exportedToCSV: `exported this report to CSV`, - exportedToIntegration: `exported this report to Integration`, - exportedToQuickBooks: `exported this report to QuickBooks`, + exportedToIntegration: ({label}: ExportedToIntegrationParams) => `exported this report to ${label}`, forwarded: ({amount, currency}: ForwardedParams) => `approved ${currency}${amount}`, + // verify errorMessage integrationsMessage: ({errorMessage}: IntegrationsMessageParams) => `failed to export this report to NetSuite. ${errorMessage}`, managerAttachReceipt: `added a receipt`, managerDetachReceipt: `removed the receipt`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 35d96466565e9..61ec00a8dd778 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1,8 +1,119 @@ import Str from 'expensify-common/lib/str'; import CONST from '@src/CONST'; -import type { ConnectionName, PolicyConnectionSyncStage } from '@src/types/onyx/Policy'; -import type { AddressLineParams, AdminCanceledRequestParams, AlreadySignedInParams, ApprovedAmountParams, BeginningOfChatHistoryAdminRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartTwo, BeginningOfChatHistoryDomainRoomPartOneParams, CanceledRequestParams, ChangeFieldParams, CharacterLimitParams, ConfirmThatParams, DateShouldBeAfterParams, DateShouldBeBeforeParams, DelegateSubmitParams, DeleteActionParams, DeleteConfirmationParams, DidSplitAmountMessageParams, DistanceRateOperationsParams, EditActionParams, ElectronicFundsParams, EnglishTranslation, EnterMagicCodeParams, FormattedMaxLengthParams, ForwardedParams, GoBackMessageParams, GoToRoomParams, InstantSummaryParams, IntegrationsMessageParams, LocalTimeParams, LoggedInAsParams, LogSizeParams, ManagerApprovedAmountParams, ManagerApprovedParams, MarkedReimbursedParams, ModifyExpenseParams, NewFaceEnterMagicCodeParams, NoLongerHaveAccessParams, NotAllowedExtensionParams, NotYouParams, OOOEventSummaryFullDayParams, OOOEventSummaryPartialDayParams, OurEmailProviderParams, PaidElsewhereWithAmountParams, PaidWithExpensifyWithAmountParams, ParentNavigationSummaryParams, PayerOwesAmountParams, PayerOwesParams, PayerPaidAmountParams, PayerPaidParams, PayerSettledParams, PaySomeoneParams, ReimbursementDelayedParams, ReimbursementRateParams, RemovedTheRequestParams, RenamedRoomActionParams, ReportArchiveReasonsClosedParams, ReportArchiveReasonsMergedParams, ReportArchiveReasonsPolicyDeletedParams, ReportArchiveReasonsRemovedFromPolicyParams, RequestAmountParams, RequestCountParams, RequestedAmountMessageParams, ResolutionConstraintsParams, RoomNameReservedErrorParams, RoomRenamedToParams, SetTheDistanceParams, SetTheRequestParams, SettledAfterAddedBankAccountParams, SettleExpensifyCardParams, ShareParams, SizeExceededParams, SplitAmountParams, StepCounterParams, StripePaidParams, TaskCreatedActionParams, TermsParams, ThreadRequestReportNameParams, ThreadSentMoneyReportNameParams, ToValidateLoginParams, TransferParams, UnapprovedParams, UntilTimeParams, UpdatedTheDistanceParams, UpdatedTheRequestParams, UsePlusButtonParams, UserIsAlreadyMemberParams, UserSplitParams, ViolationsAutoReportedRejectedExpenseParams, ViolationsCashExpenseWithNoReceiptParams, ViolationsConversionSurchargeParams, ViolationsInvoiceMarkupParams, ViolationsMaxAgeParams, ViolationsMissingTagParams, ViolationsOverAutoApprovalLimitParams, ViolationsOverCategoryLimitParams, ViolationsOverLimitParams, ViolationsPerDayLimitParams, ViolationsReceiptRequiredParams, ViolationsRterParams, ViolationsTagOutOfPolicyParams, ViolationsTaxOutOfPolicyParams, WaitingOnBankAccountParams, WalletProgramParams, WelcomeEnterMagicCodeParams, WelcomeNoteParams, WelcomeToRoomParams, WeSentYouMagicSignInLinkParams, ZipCodeExampleFormatParams } from './types'; - +import type {ConnectionName, PolicyConnectionSyncStage} from '@src/types/onyx/Policy'; +import type { + AddressLineParams, + AdminCanceledRequestParams, + AlreadySignedInParams, + ApprovedAmountParams, + BeginningOfChatHistoryAdminRoomPartOneParams, + BeginningOfChatHistoryAnnounceRoomPartOneParams, + BeginningOfChatHistoryAnnounceRoomPartTwo, + BeginningOfChatHistoryDomainRoomPartOneParams, + CanceledRequestParams, + ChangeFieldParams, + ChangePolicyParams, + ChangeTypeParams, + CharacterLimitParams, + ConfirmThatParams, + DateShouldBeAfterParams, + DateShouldBeBeforeParams, + DelegateSubmitParams, + DeleteActionParams, + DeleteConfirmationParams, + DidSplitAmountMessageParams, + DistanceRateOperationsParams, + EditActionParams, + ElectronicFundsParams, + EnglishTranslation, + EnterMagicCodeParams, + FormattedMaxLengthParams, + ForwardedParams, + GoBackMessageParams, + GoToRoomParams, + InstantSummaryParams, + IntegrationsMessageParams, + LocalTimeParams, + LoggedInAsParams, + LogSizeParams, + ManagerApprovedAmountParams, + ManagerApprovedParams, + MarkedReimbursedParams, + ModifyExpenseParams, + NewFaceEnterMagicCodeParams, + NoLongerHaveAccessParams, + NotAllowedExtensionParams, + NotYouParams, + OOOEventSummaryFullDayParams, + OOOEventSummaryPartialDayParams, + OurEmailProviderParams, + PaidElsewhereWithAmountParams, + PaidWithExpensifyWithAmountParams, + ParentNavigationSummaryParams, + PayerOwesAmountParams, + PayerOwesParams, + PayerPaidAmountParams, + PayerPaidParams, + PayerSettledParams, + PaySomeoneParams, + ReimbursementDelayedParams, + ReimbursementRateParams, + RemovedTheRequestParams, + RenamedRoomActionParams, + ReportArchiveReasonsClosedParams, + ReportArchiveReasonsMergedParams, + ReportArchiveReasonsPolicyDeletedParams, + ReportArchiveReasonsRemovedFromPolicyParams, + RequestAmountParams, + RequestCountParams, + RequestedAmountMessageParams, + ResolutionConstraintsParams, + RoomNameReservedErrorParams, + RoomRenamedToParams, + SetTheDistanceParams, + SetTheRequestParams, + SettledAfterAddedBankAccountParams, + SettleExpensifyCardParams, + ShareParams, + SizeExceededParams, + SplitAmountParams, + StepCounterParams, + StripePaidParams, + TaskCreatedActionParams, + TermsParams, + ThreadRequestReportNameParams, + ThreadSentMoneyReportNameParams, + ToValidateLoginParams, + TransferParams, + UnapprovedParams, + UntilTimeParams, + UpdatedTheDistanceParams, + UpdatedTheRequestParams, + UsePlusButtonParams, + UserIsAlreadyMemberParams, + UserSplitParams, + ViolationsAutoReportedRejectedExpenseParams, + ViolationsCashExpenseWithNoReceiptParams, + ViolationsConversionSurchargeParams, + ViolationsInvoiceMarkupParams, + ViolationsMaxAgeParams, + ViolationsMissingTagParams, + ViolationsOverAutoApprovalLimitParams, + ViolationsOverCategoryLimitParams, + ViolationsOverLimitParams, + ViolationsPerDayLimitParams, + ViolationsReceiptRequiredParams, + ViolationsRterParams, + ViolationsTagOutOfPolicyParams, + ViolationsTaxOutOfPolicyParams, + WaitingOnBankAccountParams, + WalletProgramParams, + WelcomeEnterMagicCodeParams, + WelcomeNoteParams, + WelcomeToRoomParams, + WeSentYouMagicSignInLinkParams, + ZipCodeExampleFormatParams, +} from './types'; /* eslint-disable max-len */ export default { @@ -2782,10 +2893,10 @@ export default { noActivityYet: 'Sin actividad todavía', actions: { type: { - changeField: ({value, oldValue, fieldName}: ChangeFieldParams) => `cambió ${fieldName} de ${oldValue} a ${value}`, - changePolicy: ({value, oldValue}: ModifyExpenseParams) => `cambió policy de ${oldValue} a ${value}`, - changeType: ({value, oldValue}: ModifyExpenseParams) => `cambió type de ${oldValue} a ${value}`, - delegateSubmit: ({delegateUser, awayUser}: DelegateSubmitParams) => `envié este informe a ${delegateUser} ya que ${awayUser} está de vacaciones`, + changeField: ({oldValue, newValue, fieldName}: ChangeFieldParams) => `cambió ${fieldName} de ${oldValue} a ${newValue}`, + changePolicy: ({fromPolicy, toPolicy}: ChangePolicyParams) => `cambió policy de ${fromPolicy} a ${toPolicy}`, + changeType: ({oldType, newType}: ChangeTypeParams) => `cambió type de ${oldType} a ${newType}`, + delegateSubmit: ({delegateUser, originalManager}: DelegateSubmitParams) => `envié este informe a ${delegateUser} ya que ${originalManager} está de vacaciones`, exportedToCSV: `exportó este informe a CSV`, exportedToIntegration: `exportó este informe a Integration`, exportedToQuickBooks: `exportó este informe a QuickBooks`, @@ -3578,4 +3689,4 @@ export default { systemMessage: { mergedWithCashTransaction: 'encontró un recibo para esta transacción.', }, -} satisfies EnglishTranslation; \ No newline at end of file +} satisfies EnglishTranslation; diff --git a/src/languages/types.ts b/src/languages/types.ts index 82ffc0ebcac66..55072ce9f0f90 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -298,11 +298,17 @@ type DistanceRateOperationsParams = {count: number}; type ReimbursementRateParams = {unit: Unit}; -type ModifyExpenseParams = {oldValue: string; value: string}; +type ModifyExpenseParams = {oldValue: string; newValue: string}; type ChangeFieldParams = ModifyExpenseParams & {fieldName: string}; -type DelegateSubmitParams = {delegateUser: string; awayUser: string}; +type ChangePolicyParams = {fromPolicy: string; toPolicy: string}; + +type ChangeTypeParams = {oldType: string; newType: string}; + +type DelegateSubmitParams = {delegateUser: string; originalManager: string}; + +type ExportedToIntegrationParams = {label: string}; type ForwardedParams = {amount: string; currency: string}; @@ -422,6 +428,9 @@ export type { ReimbursementRateParams, ModifyExpenseParams, ChangeFieldParams, + ChangePolicyParams, + ChangeTypeParams, + ExportedToIntegrationParams, DelegateSubmitParams, ForwardedParams, IntegrationsMessageParams, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index d4cd93827f248..fcd273c3712ed 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -909,7 +909,7 @@ function getOneTransactionThreadReportID( // - they have an assocaited IOU transaction ID or // - they have visibile childActions (like comments) that we'd want to display // - the action is pending deletion and the user is offline - (Boolean(action.originalMessage.IOUTransactionID) || + (!!action.originalMessage.IOUTransactionID || // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing (isMessageDeleted(action) && action.childVisibleActionCount) || (action.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && (isOffline ?? isNetworkOffline))), @@ -1068,8 +1068,6 @@ function isOldDotReportAction(action: ReportAction): boolean { CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY, CONST.REPORT.ACTIONS.TYPE.CHANGE_TYPE, CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT, - CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, - CONST.REPORT.ACTIONS.TYPE.DONATION, CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV, CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION, CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_QUICK_BOOKS, @@ -1084,8 +1082,6 @@ function isOldDotReportAction(action: ReportAction): boolean { CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_CANCELLED, CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACCOUNT_CHANGED, CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DELAYED, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP, CONST.REPORT.ACTIONS.TYPE.SELECTED_FOR_RANDOM_AUDIT, CONST.REPORT.ACTIONS.TYPE.SHARE, CONST.REPORT.ACTIONS.TYPE.STRIPE_PAID, @@ -1102,14 +1098,13 @@ function isOldDotReportAction(action: ReportAction): boolean { function getMessageOfOldDotReportAction({originalMessage}: ReportAction, actionName: ActionName): string { switch (actionName) { case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: { - const fieldName = getOriginalMessageModifiedField(action.originalMessage); - const {value, oldValue} = originalMessage; + const {oldValue, newValue, fieldName} = originalMessage; - return Localize.translateLocal('report.actions.type.changeField', {value, oldValue, fieldName}); + return Localize.translateLocal('report.actions.type.changeField', {oldValue, newValue, fieldName}); } case CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY: { - const {value, oldValue} = originalMessage; - return Localize.translateLocal('report.actions.type.changePolicy', {value, oldValue}); + const {fromPolicy, toPolicy} = originalMessage; + return Localize.translateLocal('report.actions.type.changePolicy', {fromPolicy, toPolicy}); } case CONST.REPORT.ACTIONS.TYPE.CHANGE_TYPE: { const {value, oldValue} = originalMessage; @@ -1245,7 +1240,7 @@ function isReportActionUnread(reportAction: OnyxEntry, lastReadTim return !isCreatedAction(reportAction); } - return Boolean(reportAction && lastReadTime && reportAction.created && lastReadTime < reportAction.created); + return !!(reportAction && lastReadTime && reportAction.created && lastReadTime < reportAction.created); } /** From e652a3e80be30360a7d6549a443956656382464c Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Thu, 20 Jun 2024 15:09:57 +0200 Subject: [PATCH 05/26] apply types --- src/languages/en.ts | 9 +- src/languages/es.ts | 15 +- src/languages/types.ts | 13 +- src/libs/ReportActionsUtils.ts | 9 +- src/pages/home/report/ReportActionItem.tsx | 3 + src/types/onyx/OldDotOriginalMessage.ts | 205 +++++++++++++++++++++ src/types/onyx/OriginalMessage.ts | 2 + 7 files changed, 236 insertions(+), 20 deletions(-) create mode 100644 src/types/onyx/OldDotOriginalMessage.ts diff --git a/src/languages/en.ts b/src/languages/en.ts index 9303a90fbef6c..ce34488e9385e 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -41,7 +41,7 @@ import type { ManagerApprovedAmountParams, ManagerApprovedParams, MarkedReimbursedParams, - ModifyExpenseParams, + MarkReimbursedFromIntegrationParams, NewFaceEnterMagicCodeParams, NoLongerHaveAccessParams, NotAllowedExtensionParams, @@ -88,6 +88,7 @@ import type { TransferParams, TranslationBase, UnapprovedParams, + UnshareParams, UntilTimeParams, UpdatedTheDistanceParams, UpdatedTheRequestParams, @@ -2863,15 +2864,15 @@ export default { managerAttachReceipt: `added a receipt`, managerDetachReceipt: `removed the receipt`, markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `paid ${currency}${amount} elsewhere`, - markedReimbursedFromIntegration: ({amount, currency}: MarkedReimbursedParams) => `paid ${currency}${amount} via integration`, + markedReimbursedFromIntegration: ({amount, currency}: MarkReimbursedFromIntegrationParams) => `paid ${currency}${amount} via integration`, outdatedBankAccount: `couldn’t process the payment due to a problem with the payer’s bank account`, reimbursementACHBounce: `couldn’t process the payment, as the payer doesn’t have sufficient funds`, reimbursementACHCancelled: `canceled the payment`, reimbursementAccountChanged: `couldn’t process the payment, as the payer changed bank accounts`, reimbursementDelayed: `processed the payment but it’s delayed by 1-2 more business days`, selectedForRandomAudit: `[randomly selected](https://help.expensify.com/articles/expensify-classic/reports/Set-a-random-report-audit-schedule) for review`, - share: ({user}: ShareParams) => `invited user ${user}`, - unshare: ({user}: ShareParams) => `removed user ${user}`, + share: ({to}: ShareParams) => `invited user ${to}`, + unshare: ({to}: UnshareParams) => `removed user ${to}`, stripePaid: ({amount, currency}: StripePaidParams) => `paid ${currency}${amount}`, takeControl: `took control`, unapproved: ({amount, currency}: UnapprovedParams) => `unapproved ${currency}${amount}`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 61ec00a8dd778..629b29091da02 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -27,6 +27,7 @@ import type { ElectronicFundsParams, EnglishTranslation, EnterMagicCodeParams, + ExportedToIntegrationParams, FormattedMaxLengthParams, ForwardedParams, GoBackMessageParams, @@ -39,7 +40,7 @@ import type { ManagerApprovedAmountParams, ManagerApprovedParams, MarkedReimbursedParams, - ModifyExpenseParams, + MarkReimbursedFromIntegrationParams, NewFaceEnterMagicCodeParams, NoLongerHaveAccessParams, NotAllowedExtensionParams, @@ -56,7 +57,6 @@ import type { PayerPaidParams, PayerSettledParams, PaySomeoneParams, - ReimbursementDelayedParams, ReimbursementRateParams, RemovedTheRequestParams, RenamedRoomActionParams, @@ -86,6 +86,7 @@ import type { ToValidateLoginParams, TransferParams, UnapprovedParams, + UnshareParams, UntilTimeParams, UpdatedTheDistanceParams, UpdatedTheRequestParams, @@ -2898,22 +2899,22 @@ export default { changeType: ({oldType, newType}: ChangeTypeParams) => `cambió type de ${oldType} a ${newType}`, delegateSubmit: ({delegateUser, originalManager}: DelegateSubmitParams) => `envié este informe a ${delegateUser} ya que ${originalManager} está de vacaciones`, exportedToCSV: `exportó este informe a CSV`, - exportedToIntegration: `exportó este informe a Integration`, - exportedToQuickBooks: `exportó este informe a QuickBooks`, + exportedToIntegration: ({label}: ExportedToIntegrationParams) => `exportó este informe a ${label}`, forwarded: ({amount, currency}: ForwardedParams) => `aprobado ${currency}${amount}`, + // verify errorMessage integrationsMessage: ({errorMessage}: IntegrationsMessageParams) => `no se pudo exportar este informe a NetSuite. ${errorMessage}`, managerAttachReceipt: `agregó un recibo`, managerDetachReceipt: `quitó el recibo`, markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `pagó ${currency}${amount} en otro lugar`, - markedReimbursedFromIntegration: ({amount, currency}: MarkedReimbursedParams) => `pagó ${currency}${amount} mediante integración`, + markedReimbursedFromIntegration: ({amount, currency}: MarkReimbursedFromIntegrationParams) => `pagó ${currency}${amount} mediante integración`, outdatedBankAccount: `no se pudo procesar el pago debido a un problema con la cuenta bancaria del pagador`, reimbursementACHBounce: `no se pudo procesar el pago porque el pagador no tiene fondos suficientes`, reimbursementACHCancelled: `canceled the payment`, reimbursementAccountChanged: `no se pudo procesar el pago porque el pagador cambió de cuenta bancaria`, reimbursementDelayed: `procesó el pago pero se retrasó entre 1 y 2 días hábiles más`, selectedForRandomAudit: `[seleccionado al azar](https://help.expensify.com/articles/expensify-classic/reports/Set-a-random-report-audit-schedule) para revisión`, - share: ({user}: ShareParams) => `usuario invitado ${user}`, - unshare: ({user}: ShareParams) => `usuario eliminado ${user}`, + share: ({to}: ShareParams) => `usuario invitado ${to}`, + 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}`, diff --git a/src/languages/types.ts b/src/languages/types.ts index 55072ce9f0f90..868fdec6bba60 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -298,9 +298,7 @@ type DistanceRateOperationsParams = {count: number}; type ReimbursementRateParams = {unit: Unit}; -type ModifyExpenseParams = {oldValue: string; newValue: string}; - -type ChangeFieldParams = ModifyExpenseParams & {fieldName: string}; +type ChangeFieldParams = {oldValue: string; newValue: string; fieldName: string}; type ChangePolicyParams = {fromPolicy: string; toPolicy: string}; @@ -316,7 +314,11 @@ type IntegrationsMessageParams = {errorMessage: string}; type MarkedReimbursedParams = {amount: string; currency: string}; -type ShareParams = {user: string}; +type MarkReimbursedFromIntegrationParams = {amount: string; currency: string}; + +type ShareParams = {to: string}; + +type UnshareParams = {to: string}; type StripePaidParams = {amount: string; currency: string}; @@ -426,7 +428,6 @@ export type { HeldRequestParams, PaySomeoneParams, ReimbursementRateParams, - ModifyExpenseParams, ChangeFieldParams, ChangePolicyParams, ChangeTypeParams, @@ -435,7 +436,9 @@ export type { ForwardedParams, IntegrationsMessageParams, MarkedReimbursedParams, + MarkReimbursedFromIntegrationParams, ShareParams, + UnshareParams, StripePaidParams, UnapprovedParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index fcd273c3712ed..3bef9833bc1e0 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -7,6 +7,7 @@ import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; +import type OldDotOriginalMessage from '@src/types/onyx/OldDotOriginalMessage'; import type { ActionName, ChangeLog, @@ -1088,14 +1089,14 @@ function isOldDotReportAction(action: ReportAction): boolean { CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL, CONST.REPORT.ACTIONS.TYPE.UNAPPROVED, CONST.REPORT.ACTIONS.TYPE.UNSHARE, - ].some((oldDotActionName) => oldDotActionName === action.actionName); + ].some((oldDotActionName) => oldDotActionName === action); } /** * Helper method to format message of OldDot Actions. * For now, we just concat all of the text elements of the message to create the full message. */ -function getMessageOfOldDotReportAction({originalMessage}: ReportAction, actionName: ActionName): string { +function getMessageOfOldDotReportAction(originalMessage: OldDotOriginalMessage, actionName: ActionName): string { switch (actionName) { case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: { const {oldValue, newValue, fieldName} = originalMessage; @@ -1107,8 +1108,8 @@ function getMessageOfOldDotReportAction({originalMessage}: ReportAction, actionN return Localize.translateLocal('report.actions.type.changePolicy', {fromPolicy, toPolicy}); } case CONST.REPORT.ACTIONS.TYPE.CHANGE_TYPE: { - const {value, oldValue} = originalMessage; - return Localize.translateLocal('report.actions.type.changeType', {value, oldValue}); + const {newType} = originalMessage; + return Localize.translateLocal('report.actions.type.changeType', {oldType: '', newType}); } case CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT: { const {delegateUser, awayUser} = originalMessage; diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 8334a761725e1..7732ba4cdc3e0 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -498,6 +498,9 @@ function ReportActionItem({ [shouldHideThreadDividerLine, styles.reportHorizontalRule, report.reportID], ); + console.log('transaction ', transaction); + console.log('report ', report); + /** * Get the content of ReportActionItem * @param hovered whether the ReportActionItem is hovered diff --git a/src/types/onyx/OldDotOriginalMessage.ts b/src/types/onyx/OldDotOriginalMessage.ts new file mode 100644 index 0000000000000..a21d9054623ad --- /dev/null +++ b/src/types/onyx/OldDotOriginalMessage.ts @@ -0,0 +1,205 @@ +import type CONST from '@src/CONST'; +import type { + ChangeFieldParams, + ChangePolicyParams, + ChangeTypeParams, + DelegateSubmitParams, + ExportedToIntegrationParams, + ForwardedParams, + IntegrationsMessageParams, + MarkedReimbursedParams, + MarkReimbursedFromIntegrationParams, + ShareParams, + StripePaidParams, + UnapprovedParams, + UnshareParams, +} from '@src/languages/types'; + +type OldDotOriginalMessageActionName = + | 'CHANGEFIELD' + | 'CHANGEPOLICY' + | 'CHANGETYPE' + | 'DELEGATESUBMIT' + | 'EXPORTCSV' + | 'EXPORTINTEGRATION' + | 'FORWARDED' + | 'INTEGRATIONSMESSAGE' + | 'MANAGERATTACHRECEIPT' + | 'MANAGERDETACHRECEIPT' + | 'MARKEDREIMBURSED' + | 'MARKREIMBURSEDFROMINTEGRATION' + | 'OUTDATEDBANKACCOUNT' + | 'REIMBURSEMENTACHBOUNCE' + | 'REIMBURSEMENTACHCANCELLED' + | 'REIMBURSEMENTACCOUNTCHANGED' + | 'REIMBURSEMENTDELAYED' + | 'SELECTEDFORRANDOMAUDIT' + | 'SHARE' + | 'STRIPEPAID' + | 'TAKECONTROL' + | 'UNAPPROVED' + | 'UNSHARE'; + +type OriginalMessageChangeField = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD; + originalMessage: ChangeFieldParams & Record; +}; + +type OriginalMessageChangePolicy = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY; + originalMessage: ChangePolicyParams & Record; +}; + +// verify +type OriginalMessageChangeType = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.CHANGE_TYPE; + originalMessage: ChangeTypeParams & Record; +}; + +type OriginalMessageDelegateSubmit = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT; + originalMessage: DelegateSubmitParams & Record; +}; + +type OriginalMessageExportedToCSV = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV; + originalMessage: Record; +}; + +type OriginalMessageExportedToIntegration = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION; + originalMessage: ExportedToIntegrationParams & Record; +}; + +// verify +type OriginalMessageForwarded = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.FORWARDED; + originalMessage: ForwardedParams & Record; +}; + +type OriginalMessageIntegrationsMessage = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE; + originalMessage: IntegrationsMessageParams & Record; +}; + +type OriginalMessageManagerAttachReceipt = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT; + originalMessage: Record; +}; + +type OriginalMessageManagerDetachReceipt = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.MANAGER_DETACH_RECEIPT; + originalMessage: Record; +}; + +// verify +type OriginalMessageMarkedReimbursed = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED; + originalMessage: MarkedReimbursedParams & Record; +}; + +type OriginalMessageMarkReimbursedFromIntegration = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.MARK_REIMBURSED_FROM_INTEGRATION; + originalMessage: MarkReimbursedFromIntegrationParams & Record; +}; + +type OriginalMessageOutdatedBankAccount = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.OUTDATED_BANK_ACCOUNT; + originalMessage: Record; +}; + +type OriginalMessageReimbursementACHBounce = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_BOUNCE; + originalMessage: Record; +}; + +type OriginalMessageReimbursementACHCancelled = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_CANCELLED; + originalMessage: Record; +}; + +type OriginalMessageReimbursementAccountChanged = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACCOUNT_CHANGED; + originalMessage: Record; +}; + +type OriginalMessageReimbursementDelayed = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DELAYED; + originalMessage: Record; +}; + +type OriginalMessageSelectedForRandomAudit = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.SELECTED_FOR_RANDOM_AUDIT; + originalMessage: Record; +}; + +type OriginalMessageShare = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.SHARE; + originalMessage: ShareParams & Record; +}; + +type OriginalMessageUnshare = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.UNSHARE; + originalMessage: UnshareParams & Record; +}; + +// verify +type OriginalMessageStripePaid = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.STRIPE_PAID; + originalMessage: StripePaidParams & Record; +}; + +type OriginalMessageTakeControl = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL; + originalMessage: Record; +}; + +// verify +type OriginalMessageUnapproved = { + actionName: typeof CONST.REPORT.ACTIONS.TYPE.UNAPPROVED; + originalMessage: UnapprovedParams & Record; +}; + +type OldDotOriginalMessage = + | OriginalMessageChangeField + | OriginalMessageChangePolicy + | OldDotOriginalMessageActionName + | OriginalMessageDelegateSubmit + | OriginalMessageExportedToCSV + | OriginalMessageExportedToIntegration + | OriginalMessageIntegrationsMessage + | OriginalMessageManagerAttachReceipt + | OriginalMessageManagerDetachReceipt + | OriginalMessageMarkReimbursedFromIntegration + | OriginalMessageOutdatedBankAccount + | OriginalMessageReimbursementACHBounce + | OriginalMessageReimbursementACHCancelled + | OriginalMessageReimbursementAccountChanged + | OriginalMessageReimbursementDelayed + | OriginalMessageSelectedForRandomAudit + | OriginalMessageShare + | OriginalMessageUnshare + | OriginalMessageTakeControl; + +export default OldDotOriginalMessage; +export type { + OriginalMessageChangeField, + OldDotOriginalMessageActionName, + OriginalMessageChangePolicy, + OriginalMessageDelegateSubmit, + OriginalMessageExportedToCSV, + OriginalMessageExportedToIntegration, + OriginalMessageIntegrationsMessage, + OriginalMessageManagerAttachReceipt, + OriginalMessageManagerDetachReceipt, + OriginalMessageMarkReimbursedFromIntegration, + OriginalMessageOutdatedBankAccount, + OriginalMessageReimbursementACHBounce, + OriginalMessageReimbursementACHCancelled, + OriginalMessageReimbursementAccountChanged, + OriginalMessageReimbursementDelayed, + OriginalMessageSelectedForRandomAudit, + OriginalMessageShare, + OriginalMessageUnshare, + OriginalMessageTakeControl, +}; diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index b079a64ebb4b2..97f3e9a58a458 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -1,6 +1,7 @@ import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; +import type OldDotOriginalMessage from './OldDotOriginalMessage'; type PaymentMethodType = DeepValueOf; @@ -369,6 +370,7 @@ type OriginalMessage = | OriginalMessageActionableTrackedExpenseWhisper | OriginalMessageMergedWithCashTransaction | OriginalMessageDismissedViolation; +// | OldDotOriginalMessage; export default OriginalMessage; export type { From ba7510447d68140dc51c57473b1ed9e0e64cc99d Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Thu, 20 Jun 2024 23:34:37 +0200 Subject: [PATCH 06/26] adjust types --- src/CONST.ts | 1 - src/libs/ReportActionsUtils.ts | 63 +++++++--------------- src/pages/home/report/ReportActionItem.tsx | 5 +- src/types/onyx/OldDotOriginalMessage.ts | 5 +- src/types/onyx/OriginalMessage.ts | 4 +- src/types/onyx/ReportAction.ts | 15 +++++- 6 files changed, 38 insertions(+), 55 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index c6295293f2f09..2bf996b9c4fb4 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -661,7 +661,6 @@ const CONST = { DISMISSED_VIOLATION: 'DISMISSEDVIOLATION', EXPORTED_TO_CSV: 'EXPORTCSV', // OldDot Action EXPORTED_TO_INTEGRATION: 'EXPORTINTEGRATION', // OldDot Action - EXPORTED_TO_QUICK_BOOKS: 'EXPORTED', // OldDot Action FORWARDED: 'FORWARDED', // OldDot Action HOLD: 'HOLD', HOLD_COMMENT: 'HOLDCOMMENT', diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 3bef9833bc1e0..f6ae84248e964 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -21,7 +21,7 @@ import type { OriginalMessageReimbursementDequeued, } from '@src/types/onyx/OriginalMessage'; import type Report from '@src/types/onyx/Report'; -import type {Message, ReportActionBase, ReportActionMessageJSON, ReportActions} from '@src/types/onyx/ReportAction'; +import type {Message, OldDotReportAction, ReportActionBase, ReportActionMessageJSON, ReportActions} from '@src/types/onyx/ReportAction'; import type ReportAction from '@src/types/onyx/ReportAction'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; @@ -32,7 +32,6 @@ import * as Localize from './Localize'; import Log from './Log'; import type {MessageElementBase, MessageTextElement} from './MessageElement'; import * as PersonalDetailsUtils from './PersonalDetailsUtils'; -import {getOriginalMessageModifiedField} from './ReportUtils'; import type {OptimisticIOUReportAction} from './ReportUtils'; import StringUtils from './StringUtils'; import * as TransactionUtils from './TransactionUtils'; @@ -508,16 +507,16 @@ function isReportActionDeprecated(reportAction: OnyxEntry, key: st return true; } - const deprecatedOldDotReportActions: ActionName[] = [ - CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED, - CONST.REPORT.ACTIONS.TYPE.DONATION, - ]; - if (deprecatedOldDotReportActions.includes(reportAction.actionName as ActionName)) { - Log.info('Front end filtered out reportAction for being an older, deprecated report action', false, reportAction); - return true; - } + // const deprecatedOldDotReportActions: ActionName[] = [ + // CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, + // CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, + // CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED, + // CONST.REPORT.ACTIONS.TYPE.DONATION, + // ]; + // if (deprecatedOldDotReportActions.includes(reportAction.actionName as ActionName)) { + // Log.info('Front end filtered out reportAction for being an older, deprecated report action', false, reportAction); + // return true; + // } return false; } @@ -1063,7 +1062,7 @@ function getMemberChangeMessageFragment(reportAction: OnyxEntry): }; } -function isOldDotReportAction(action: ReportAction): boolean { +function isOldDotReportAction(action: ReportAction | OldDotReportAction): action is OldDotReportAction { return [ CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD, CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY, @@ -1071,7 +1070,6 @@ function isOldDotReportAction(action: ReportAction): boolean { CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT, CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV, CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION, - CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_QUICK_BOOKS, CONST.REPORT.ACTIONS.TYPE.FORWARDED, CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE, CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT, @@ -1089,14 +1087,13 @@ function isOldDotReportAction(action: ReportAction): boolean { CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL, CONST.REPORT.ACTIONS.TYPE.UNAPPROVED, CONST.REPORT.ACTIONS.TYPE.UNSHARE, - ].some((oldDotActionName) => oldDotActionName === action); + ].some((oldDotActionName) => oldDotActionName === action.actionName); } /** * Helper method to format message of OldDot Actions. - * For now, we just concat all of the text elements of the message to create the full message. */ -function getMessageOfOldDotReportAction(originalMessage: OldDotOriginalMessage, actionName: ActionName): string { +function getMessageOfOldDotReportAction({originalMessage, actionName}: OldDotOriginalMessage): string { switch (actionName) { case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: { const {oldValue, newValue, fieldName} = originalMessage; @@ -1107,34 +1104,20 @@ function getMessageOfOldDotReportAction(originalMessage: OldDotOriginalMessage, const {fromPolicy, toPolicy} = originalMessage; return Localize.translateLocal('report.actions.type.changePolicy', {fromPolicy, toPolicy}); } - case CONST.REPORT.ACTIONS.TYPE.CHANGE_TYPE: { - const {newType} = originalMessage; - return Localize.translateLocal('report.actions.type.changeType', {oldType: '', newType}); - } case CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT: { - const {delegateUser, awayUser} = originalMessage; - return Localize.translateLocal('report.actions.type.delegateSubmit', {delegateUser, awayUser}); + const {delegateUser, originalManager} = originalMessage; + return Localize.translateLocal('report.actions.type.delegateSubmit', {delegateUser, originalManager}); } case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV: return Localize.translateLocal('report.actions.type.exportedToCSV'); case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION: - return Localize.translateLocal('report.actions.type.exportedToIntegration'); - case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_QUICK_BOOKS: - return Localize.translateLocal('report.actions.type.exportedToQuickBooks'); - case CONST.REPORT.ACTIONS.TYPE.FORWARDED: { - const {amount, currency} = originalMessage; - return Localize.translateLocal('report.actions.type.forwarded', {amount, currency}); - } + return Localize.translateLocal('report.actions.type.exportedToIntegration', {label: originalMessage.label}); case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: return Localize.translateLocal('report.actions.type.integrationsMessage', {errorMessage: originalMessage.errorMessage}); case CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT: return Localize.translateLocal('report.actions.type.managerAttachReceipt'); case CONST.REPORT.ACTIONS.TYPE.MANAGER_DETACH_RECEIPT: return Localize.translateLocal('report.actions.type.managerDetachReceipt'); - case CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED: { - const {amount, currency} = originalMessage; - return Localize.translateLocal('report.actions.type.markedReimbursed', {amount, currency}); - } case CONST.REPORT.ACTIONS.TYPE.MARK_REIMBURSED_FROM_INTEGRATION: { const {amount, currency} = originalMessage; return Localize.translateLocal('report.actions.type.markedReimbursedFromIntegration', {amount, currency}); @@ -1152,19 +1135,11 @@ function getMessageOfOldDotReportAction(originalMessage: OldDotOriginalMessage, case CONST.REPORT.ACTIONS.TYPE.SELECTED_FOR_RANDOM_AUDIT: return Localize.translateLocal('report.actions.type.selectedForRandomAudit'); case CONST.REPORT.ACTIONS.TYPE.SHARE: - return Localize.translateLocal('report.actions.type.share', {user: originalMessage.invitedUser}); + return Localize.translateLocal('report.actions.type.share', {to: originalMessage.to}); case CONST.REPORT.ACTIONS.TYPE.UNSHARE: - return Localize.translateLocal('report.actions.type.unshare', {user: originalMessage.removedUser}); - case CONST.REPORT.ACTIONS.TYPE.STRIPE_PAID: { - const {amount, currency} = originalMessage; - return Localize.translateLocal('report.actions.type.stripePaid', {amount, currency}); - } + return Localize.translateLocal('report.actions.type.unshare', {to: originalMessage.to}); case CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL: return Localize.translateLocal('report.actions.type.takeControl'); - case CONST.REPORT.ACTIONS.TYPE.UNAPPROVED: { - const {amount, currency} = originalMessage; - return Localize.translateLocal('report.actions.type.unapproved', {amount, currency}); - } default: return ''; } diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 7732ba4cdc3e0..4b248bf14131e 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -498,9 +498,6 @@ function ReportActionItem({ [shouldHideThreadDividerLine, styles.reportHorizontalRule, report.reportID], ); - console.log('transaction ', transaction); - console.log('report ', report); - /** * Get the content of ReportActionItem * @param hovered whether the ReportActionItem is hovered @@ -621,7 +618,7 @@ function ReportActionItem({ children = ; } else if (ReportActionsUtils.isOldDotReportAction(action)) { // This handles all historical actions from OldDot that we just want to display the message text - children = ; + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD_COMMENT) { diff --git a/src/types/onyx/OldDotOriginalMessage.ts b/src/types/onyx/OldDotOriginalMessage.ts index a21d9054623ad..66c99dc197d6a 100644 --- a/src/types/onyx/OldDotOriginalMessage.ts +++ b/src/types/onyx/OldDotOriginalMessage.ts @@ -42,7 +42,7 @@ type OldDotOriginalMessageActionName = type OriginalMessageChangeField = { actionName: typeof CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD; - originalMessage: ChangeFieldParams & Record; + originalMessage: Record & ChangeFieldParams; }; type OriginalMessageChangePolicy = { @@ -72,7 +72,7 @@ type OriginalMessageExportedToIntegration = { }; // verify -type OriginalMessageForwarded = { +type OriginalMessagePolicyTask = { actionName: typeof CONST.REPORT.ACTIONS.TYPE.FORWARDED; originalMessage: ForwardedParams & Record; }; @@ -163,7 +163,6 @@ type OriginalMessageUnapproved = { type OldDotOriginalMessage = | OriginalMessageChangeField | OriginalMessageChangePolicy - | OldDotOriginalMessageActionName | OriginalMessageDelegateSubmit | OriginalMessageExportedToCSV | OriginalMessageExportedToIntegration diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 97f3e9a58a458..097cae5c03e7d 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -369,8 +369,8 @@ type OriginalMessage = | OriginalMessageMarkedReimbursed | OriginalMessageActionableTrackedExpenseWhisper | OriginalMessageMergedWithCashTransaction - | OriginalMessageDismissedViolation; -// | OldDotOriginalMessage; + | OriginalMessageDismissedViolation + | OldDotOriginalMessage; export default OriginalMessage; export type { diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index d7333feb86505..e1978152928cb 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -5,6 +5,7 @@ import type CONST from '@src/CONST'; import type ONYXKEYS from '@src/ONYXKEYS'; import type CollectionDataSet from '@src/types/utils/CollectionDataSet'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; +import type OldDotOriginalMessage from './OldDotOriginalMessage'; import type * as OnyxCommon from './OnyxCommon'; import type {Decision, OriginalMessageModifiedExpense, OriginalMessageReportPreview, Reaction} from './OriginalMessage'; import type OriginalMessage from './OriginalMessage'; @@ -233,6 +234,7 @@ type ReportActionBase = OnyxCommon.OnyxValueWithOfflineFeedback<{ }>; type ReportAction = ReportActionBase & OriginalMessage; +type OldDotReportAction = ReportActionBase & OldDotOriginalMessage; type ReportPreviewAction = ReportActionBase & OriginalMessageReportPreview; type ModifiedExpenseAction = ReportActionBase & OriginalMessageModifiedExpense; @@ -241,4 +243,15 @@ type ReportActions = Record; type ReportActionsCollectionDataSet = CollectionDataSet; export default ReportAction; -export type {ReportActions, ReportActionBase, Message, LinkMetadata, OriginalMessage, ReportActionsCollectionDataSet, ReportPreviewAction, ModifiedExpenseAction, ReportActionMessageJSON}; +export type { + ReportActions, + OldDotReportAction, + ReportActionBase, + Message, + LinkMetadata, + OriginalMessage, + ReportActionsCollectionDataSet, + ReportPreviewAction, + ModifiedExpenseAction, + ReportActionMessageJSON, +}; From 8164d80914d0bbcfa2892482f1b254ef46297bd6 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Thu, 20 Jun 2024 23:42:04 +0200 Subject: [PATCH 07/26] revert deprecated messages --- src/CONST.ts | 5 +++++ src/libs/ReportActionsUtils.ts | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 2bf996b9c4fb4..64b015c548516 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -658,7 +658,9 @@ const CONST = { CLOSED: 'CLOSED', CREATED: 'CREATED', DELEGATE_SUBMIT: 'DELEGATESUBMIT', // OldDot Action + DELETED_ACCOUNT: 'DELETEDACCOUNT', // Deprecated OldDot Action DISMISSED_VIOLATION: 'DISMISSEDVIOLATION', + DONATION: 'DONATION', // Deprecated OldDot Action EXPORTED_TO_CSV: 'EXPORTCSV', // OldDot Action EXPORTED_TO_INTEGRATION: 'EXPORTINTEGRATION', // OldDot Action FORWARDED: 'FORWARDED', // OldDot Action @@ -680,6 +682,9 @@ const CONST = { REIMBURSEMENT_DELAYED: 'REIMBURSEMENTDELAYED', // OldDot Action REIMBURSEMENT_QUEUED: 'REIMBURSEMENTQUEUED', REIMBURSEMENT_DEQUEUED: 'REIMBURSEMENTDEQUEUED', + REIMBURSEMENT_REQUESTED: 'REIMBURSEMENTREQUESTED', // Deprecated OldDot Action + REIMBURSEMENT_SETUP: 'REIMBURSEMENTSETUP', // Deprecated OldDot Action + REIMBURSEMENT_SETUP_REQUESTED: 'REIMBURSEMENTSETUPREQUESTED', // Deprecated OldDot Action RENAMED: 'RENAMED', REPORT_PREVIEW: 'REPORTPREVIEW', SELECTED_FOR_RANDOM_AUDIT: 'SELECTEDFORRANDOMAUDIT', // OldDot Action diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index f6ae84248e964..f854148c67c69 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -507,16 +507,16 @@ function isReportActionDeprecated(reportAction: OnyxEntry, key: st return true; } - // const deprecatedOldDotReportActions: ActionName[] = [ - // CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, - // CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, - // CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED, - // CONST.REPORT.ACTIONS.TYPE.DONATION, - // ]; - // if (deprecatedOldDotReportActions.includes(reportAction.actionName as ActionName)) { - // Log.info('Front end filtered out reportAction for being an older, deprecated report action', false, reportAction); - // return true; - // } + const deprecatedOldDotReportActions: ActionName[] = [ + CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED, + CONST.REPORT.ACTIONS.TYPE.DONATION, + ]; + if (deprecatedOldDotReportActions.includes(reportAction.actionName as ActionName)) { + Log.info('Front end filtered out reportAction for being an older, deprecated report action', false, reportAction); + return true; + } return false; } From fd96a707bf094107dbe29baca89cb18b5461c689 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Thu, 20 Jun 2024 23:43:12 +0200 Subject: [PATCH 08/26] cleanup --- src/libs/ReportActionsUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index f854148c67c69..38c2db3f32853 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1216,7 +1216,7 @@ function isReportActionUnread(reportAction: OnyxEntry, lastReadTim return !isCreatedAction(reportAction); } - return !!(reportAction && lastReadTime && reportAction.created && lastReadTime < reportAction.created); + return Boolean(reportAction && lastReadTime && reportAction.created && lastReadTime < reportAction.created); } /** From a3f0195be61337eae31327b630d5d3f2b9af3ce0 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Mon, 24 Jun 2024 10:33:16 +0200 Subject: [PATCH 09/26] cleanup --- ios/Podfile.lock | 43 ++++++++++++++++++++++++++-------- src/CONST.ts | 5 ---- src/libs/ReportActionsUtils.ts | 11 --------- src/libs/ReportUtils.ts | 12 +++++----- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index eee5c82f82ae7..077003ed52851 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -138,7 +138,7 @@ PODS: - GoogleUtilities/Environment (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - fmt (6.2.1) - - FullStory (1.48.0) + - FullStory (1.49.0) - fullstory_react-native (1.4.2): - FullStory (~> 1.14) - glog @@ -1303,6 +1303,25 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga + - react-native-keyboard-controller (1.12.2): + - glog + - hermes-engine + - RCT-Folly (= 2022.05.16.00) + - RCTRequired + - RCTTypeSafety + - React-Codegen + - React-Core + - React-debug + - React-Fabric + - React-graphics + - React-ImageManager + - React-NativeModulesApple + - React-RCTFabric + - React-rendererdebug + - React-utils + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - Yoga - react-native-launch-arguments (4.0.2): - React - react-native-netinfo (11.2.1): @@ -1852,7 +1871,7 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core - - RNLiveMarkdown (0.1.70): + - RNLiveMarkdown (0.1.85): - glog - hermes-engine - RCT-Folly (= 2022.05.16.00) @@ -1870,9 +1889,9 @@ PODS: - React-utils - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNLiveMarkdown/common (= 0.1.70) + - RNLiveMarkdown/common (= 0.1.85) - Yoga - - RNLiveMarkdown/common (0.1.70): + - RNLiveMarkdown/common (0.1.85): - glog - hermes-engine - RCT-Folly (= 2022.05.16.00) @@ -2098,7 +2117,7 @@ DEPENDENCIES: - ExpoImageManipulator (from `../node_modules/expo-image-manipulator/ios`) - ExpoModulesCore (from `../node_modules/expo-modules-core`) - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) - - "FullStory (from `{:http=>\"https://ios-releases.fullstory.com/fullstory-1.48.0-xcframework.tar.gz\"}`)" + - "FullStory (from `{:http=>\"https://ios-releases.fullstory.com/fullstory-1.49.0-xcframework.tar.gz\"}`)" - "fullstory_react-native (from `../node_modules/@fullstory/react-native`)" - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) @@ -2137,6 +2156,7 @@ DEPENDENCIES: - "react-native-geolocation (from `../node_modules/@react-native-community/geolocation`)" - react-native-image-picker (from `../node_modules/react-native-image-picker`) - react-native-key-command (from `../node_modules/react-native-key-command`) + - react-native-keyboard-controller (from `../node_modules/react-native-keyboard-controller`) - react-native-launch-arguments (from `../node_modules/react-native-launch-arguments`) - "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)" - react-native-pager-view (from `../node_modules/react-native-pager-view`) @@ -2263,7 +2283,7 @@ EXTERNAL SOURCES: FBLazyVector: :path: "../node_modules/react-native/Libraries/FBLazyVector" FullStory: - :http: https://ios-releases.fullstory.com/fullstory-1.48.0-xcframework.tar.gz + :http: https://ios-releases.fullstory.com/fullstory-1.49.0-xcframework.tar.gz fullstory_react-native: :path: "../node_modules/@fullstory/react-native" glog: @@ -2335,6 +2355,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-image-picker" react-native-key-command: :path: "../node_modules/react-native-key-command" + react-native-keyboard-controller: + :path: "../node_modules/react-native-keyboard-controller" react-native-launch-arguments: :path: "../node_modules/react-native-launch-arguments" react-native-netinfo: @@ -2458,7 +2480,7 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: FullStory: - :http: https://ios-releases.fullstory.com/fullstory-1.48.0-xcframework.tar.gz + :http: https://ios-releases.fullstory.com/fullstory-1.49.0-xcframework.tar.gz SPEC CHECKSUMS: Airship: 5a6d3f8a982398940b0d48423bb9b8736717c123 @@ -2485,7 +2507,7 @@ SPEC CHECKSUMS: FirebasePerformance: 0c01a7a496657d7cea86d40c0b1725259d164c6c FirebaseRemoteConfig: 2d6e2cfdb49af79535c8af8a80a4a5009038ec2b fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - FullStory: 097347c823c21c655ca25fd8d5e6355a9326ec54 + FullStory: c95f74445f871bc344cdc4a4e4ece61b5554e55d fullstory_react-native: 6cba8a2c054374a24a44dc4310407d9435459cae glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2 GoogleAppMeasurement: 5ba1164e3c844ba84272555e916d0a6d3d977e91 @@ -2541,6 +2563,7 @@ SPEC CHECKSUMS: react-native-geolocation: f9e92eb774cb30ac1e099f34b3a94f03b4db7eb3 react-native-image-picker: f8a13ff106bcc7eb00c71ce11fdc36aac2a44440 react-native-key-command: 28ccfa09520e7d7e30739480dea4df003493bfe8 + react-native-keyboard-controller: 47c01b0741ae5fc84e53cf282e61cfa5c2edb19b react-native-launch-arguments: 5f41e0abf88a15e3c5309b8875d6fd5ac43df49d react-native-netinfo: 02d31de0e08ab043d48f2a1a8baade109d7b6ca5 react-native-pager-view: ccd4bbf9fc7effaf8f91f8dae43389844d9ef9fa @@ -2589,7 +2612,7 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 74b7b3d06d667ba0bbf41da7718f2607ae0dfe8f RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 - RNLiveMarkdown: 23250f3d64c9d5f82ff36c4733c03544af0222d2 + RNLiveMarkdown: fff70dc755ed8199a449f61e76cbadec7cd20440 RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: df8fe93dbd251f25022f4023d31bc04160d4d65c RNPermissions: 0b61d30d21acbeafe25baaa47d9bae40a0c65216 @@ -2608,6 +2631,6 @@ SPEC CHECKSUMS: VisionCamera: 1394a316c7add37e619c48d7aa40b38b954bf055 Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312 -PODFILE CHECKSUM: 66a5c97ae1059e4da1993a4ad95abe5d819f555b +PODFILE CHECKSUM: d5e281e5370cb0211a104efd90eb5fa7af936e14 COCOAPODS: 1.13.0 diff --git a/src/CONST.ts b/src/CONST.ts index 64b015c548516..2bf996b9c4fb4 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -658,9 +658,7 @@ const CONST = { CLOSED: 'CLOSED', CREATED: 'CREATED', DELEGATE_SUBMIT: 'DELEGATESUBMIT', // OldDot Action - DELETED_ACCOUNT: 'DELETEDACCOUNT', // Deprecated OldDot Action DISMISSED_VIOLATION: 'DISMISSEDVIOLATION', - DONATION: 'DONATION', // Deprecated OldDot Action EXPORTED_TO_CSV: 'EXPORTCSV', // OldDot Action EXPORTED_TO_INTEGRATION: 'EXPORTINTEGRATION', // OldDot Action FORWARDED: 'FORWARDED', // OldDot Action @@ -682,9 +680,6 @@ const CONST = { REIMBURSEMENT_DELAYED: 'REIMBURSEMENTDELAYED', // OldDot Action REIMBURSEMENT_QUEUED: 'REIMBURSEMENTQUEUED', REIMBURSEMENT_DEQUEUED: 'REIMBURSEMENTDEQUEUED', - REIMBURSEMENT_REQUESTED: 'REIMBURSEMENTREQUESTED', // Deprecated OldDot Action - REIMBURSEMENT_SETUP: 'REIMBURSEMENTSETUP', // Deprecated OldDot Action - REIMBURSEMENT_SETUP_REQUESTED: 'REIMBURSEMENTSETUPREQUESTED', // Deprecated OldDot Action RENAMED: 'RENAMED', REPORT_PREVIEW: 'REPORTPREVIEW', SELECTED_FOR_RANDOM_AUDIT: 'SELECTEDFORRANDOMAUDIT', // OldDot Action diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 38c2db3f32853..588791ea9e08a 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -507,17 +507,6 @@ function isReportActionDeprecated(reportAction: OnyxEntry, key: st return true; } - const deprecatedOldDotReportActions: ActionName[] = [ - CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED, - CONST.REPORT.ACTIONS.TYPE.DONATION, - ]; - if (deprecatedOldDotReportActions.includes(reportAction.actionName as ActionName)) { - Log.info('Front end filtered out reportAction for being an older, deprecated report action', false, reportAction); - return true; - } - return false; } diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 3d2ab6383736c..13b110ae6f14f 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3043,12 +3043,12 @@ function getModifiedExpenseOriginalMessage( const ORIGINAL_MESSAGE_FIELDS = ['comment', 'created', 'merchant', 'amount', 'currency', 'category', 'tag', 'taxCode', 'taxAmount', 'billable'] as const; -// /** -// * Detect and return a modified field name based on the original message. -// * -// * At the moment, we only allow changing one transaction field at a time. -// * @param originalMessage -// */ +/** + * Detect and return a modified field name based on the original message. + * + * At the moment, we only allow changing one transaction field at a time. + * @param originalMessage + */ function getOriginalMessageModifiedField({originalMessage}: OriginalMessage): string { if (typeof originalMessage !== 'object' || originalMessage === null) { return ''; From 47226ed4cca4109f27331f419d208170ab441dda Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Mon, 24 Jun 2024 11:59:06 +0200 Subject: [PATCH 10/26] cleanup --- ios/Podfile.lock | 88 ++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 48 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 04fd47779f52d..9b8f501909273 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -19,12 +19,12 @@ PODS: - Airship/Core - AirshipFrameworkProxy (5.1.1): - Airship (= 17.7.3) - - AirshipServiceExtension (17.8.0) - - AppAuth (1.6.2): - - AppAuth/Core (= 1.6.2) - - AppAuth/ExternalUserAgent (= 1.6.2) - - AppAuth/Core (1.6.2) - - AppAuth/ExternalUserAgent (1.6.2): + - AirshipServiceExtension (18.4.0) + - AppAuth (1.7.5): + - AppAuth/Core (= 1.7.5) + - AppAuth/ExternalUserAgent (= 1.7.5) + - AppAuth/Core (1.7.5) + - AppAuth/ExternalUserAgent (1.7.5): - AppAuth/Core - boost (1.83.0) - BVLinearGradient (2.8.1): @@ -184,44 +184,44 @@ PODS: - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30911.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) - - GoogleSignIn (7.0.0): - - AppAuth (~> 1.5) - - GTMAppAuth (< 3.0, >= 1.3) - - GTMSessionFetcher/Core (< 4.0, >= 1.1) - - GoogleUtilities/AppDelegateSwizzler (7.13.0): + - GoogleSignIn (7.1.0): + - AppAuth (< 2.0, >= 1.7.3) + - GTMAppAuth (< 5.0, >= 4.1.1) + - GTMSessionFetcher/Core (~> 3.3) + - GoogleUtilities/AppDelegateSwizzler (7.13.3): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - GoogleUtilities/Privacy - - GoogleUtilities/Environment (7.13.0): + - GoogleUtilities/Environment (7.13.3): - GoogleUtilities/Privacy - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/ISASwizzler (7.13.0): + - GoogleUtilities/ISASwizzler (7.13.3): - GoogleUtilities/Privacy - - GoogleUtilities/Logger (7.13.0): + - GoogleUtilities/Logger (7.13.3): - GoogleUtilities/Environment - GoogleUtilities/Privacy - - GoogleUtilities/MethodSwizzler (7.13.0): + - GoogleUtilities/MethodSwizzler (7.13.3): - GoogleUtilities/Logger - GoogleUtilities/Privacy - - GoogleUtilities/Network (7.13.0): + - GoogleUtilities/Network (7.13.3): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Privacy - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (7.13.0)": + - "GoogleUtilities/NSData+zlib (7.13.3)": - GoogleUtilities/Privacy - - GoogleUtilities/Privacy (7.13.0) - - GoogleUtilities/Reachability (7.13.0): + - GoogleUtilities/Privacy (7.13.3) + - GoogleUtilities/Reachability (7.13.3): - GoogleUtilities/Logger - GoogleUtilities/Privacy - - GoogleUtilities/UserDefaults (7.13.0): + - GoogleUtilities/UserDefaults (7.13.3): - GoogleUtilities/Logger - GoogleUtilities/Privacy - - GTMAppAuth (2.0.0): - - AppAuth/Core (~> 1.6) - - GTMSessionFetcher/Core (< 4.0, >= 1.5) - - GTMSessionFetcher/Core (3.3.1) + - GTMAppAuth (4.1.1): + - AppAuth/Core (~> 1.7) + - GTMSessionFetcher/Core (< 4.0, >= 3.3) + - GTMSessionFetcher/Core (3.4.1) - hermes-engine (0.73.4): - hermes-engine/Pre-built (= 0.73.4) - hermes-engine/Pre-built (0.73.4) @@ -282,7 +282,7 @@ PODS: - nanopb/encode (= 2.30908.0) - nanopb/decode (2.30908.0) - nanopb/encode (2.30908.0) - - Onfido (29.7.1) + - Onfido (29.7.2) - onfido-react-native-sdk (10.6.0): - glog - hermes-engine @@ -1243,7 +1243,13 @@ PODS: - react-native-config (1.5.0): - react-native-config/App (= 1.5.0) - react-native-config/App (1.5.0): - - React-Core + - RCT-Folly + - RCTRequired + - RCTTypeSafety + - React + - React-Codegen + - React-RCTFabric + - ReactCommon/turbomodule/core - react-native-document-picker (9.1.1): - RCT-Folly - RCTRequired @@ -1865,11 +1871,7 @@ PODS: - RNGoogleSignin (10.0.1): - GoogleSignIn (~> 7.0) - React-Core -<<<<<<< HEAD - - RNLiveMarkdown (0.1.85): -======= - RNLiveMarkdown (0.1.88): ->>>>>>> origin/main - glog - hermes-engine - RCT-Folly (= 2022.05.16.00) @@ -1887,15 +1889,9 @@ PODS: - React-utils - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core -<<<<<<< HEAD - - RNLiveMarkdown/common (= 0.1.85) - - Yoga - - RNLiveMarkdown/common (0.1.85): -======= - RNLiveMarkdown/common (= 0.1.88) - Yoga - RNLiveMarkdown/common (0.1.88): ->>>>>>> origin/main - glog - hermes-engine - RCT-Folly (= 2022.05.16.00) @@ -2489,8 +2485,8 @@ CHECKOUT OPTIONS: SPEC CHECKSUMS: Airship: 5a6d3f8a982398940b0d48423bb9b8736717c123 AirshipFrameworkProxy: 7255f4ed9836dc2920f2f1ea5657ced4cee8a35c - AirshipServiceExtension: 0a5fb14c3fd1879355ab05a81d10f64512a4f79c - AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570 + AirshipServiceExtension: 6216e677a5ef6f2bc365db95b0eeca1b905afde0 + AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa boost: d3f49c53809116a5d38da093a8aa78bf551aed09 BVLinearGradient: 421743791a59d259aec53f4c58793aad031da2ca DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953 @@ -2516,10 +2512,10 @@ SPEC CHECKSUMS: glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2 GoogleAppMeasurement: 5ba1164e3c844ba84272555e916d0a6d3d977e91 GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a - GoogleSignIn: b232380cf495a429b8095d3178a8d5855b42e842 - GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152 - GTMAppAuth: 99fb010047ba3973b7026e45393f51f27ab965ae - GTMSessionFetcher: 8a1b34ad97ebe6f909fb8b9b77fba99943007556 + GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db + GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 + GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de + GTMSessionFetcher: 8000756fc1c19d2e5697b90311f7832d2e33f6cd hermes-engine: b2669ce35fc4ac14f523b307aff8896799829fe2 libaom: 144606b1da4b5915a1054383c3a4459ccdb3c661 libavif: 84bbb62fb232c3018d6f1bab79beea87e35de7b7 @@ -2533,7 +2529,7 @@ SPEC CHECKSUMS: MapboxMaps: 87ef0003e6db46e45e7a16939f29ae87e38e7ce2 MapboxMobileEvents: de50b3a4de180dd129c326e09cd12c8adaaa46d6 nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 - Onfido: 342cbecd7a4383e98dfe7f9c35e98aaece599062 + Onfido: f3af62ea1c9a419589c133e3e511e5d2c4f3f8af onfido-react-native-sdk: 3e3b0dd70afa97410fb318d54c6a415137968ef2 Plaid: 7829e84db6d766a751c91a402702946d2977ddcb PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 @@ -2562,7 +2558,7 @@ SPEC CHECKSUMS: react-native-airship: 38e2596999242b68c933959d6145512e77937ac0 react-native-blob-util: 1ddace5234c62e3e6e4e154d305ad07ef686599b react-native-cameraroll: f373bebbe9f6b7c3fd2a6f97c5171cda574cf957 - react-native-config: 5330c8258265c1e5fdb8c009d2cabd6badd96727 + react-native-config: 5ce986133b07fc258828b20b9506de0e683efc1c react-native-document-picker: 8532b8af7c2c930f9e202aac484ac785b0f4f809 react-native-geolocation: f9e92eb774cb30ac1e099f34b3a94f03b4db7eb3 react-native-image-picker: f8a13ff106bcc7eb00c71ce11fdc36aac2a44440 @@ -2616,11 +2612,7 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 74b7b3d06d667ba0bbf41da7718f2607ae0dfe8f RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 -<<<<<<< HEAD - RNLiveMarkdown: fff70dc755ed8199a449f61e76cbadec7cd20440 -======= RNLiveMarkdown: e33d2c97863d5480f8f4b45f8b25f801cc43c7f5 ->>>>>>> origin/main RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: df8fe93dbd251f25022f4023d31bc04160d4d65c RNPermissions: 0b61d30d21acbeafe25baaa47d9bae40a0c65216 From c907cb614d6ade801acc3661a30663b89c9f8684 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Mon, 24 Jun 2024 11:59:47 +0200 Subject: [PATCH 11/26] cleanup --- ios/Podfile.lock | 76 ++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 41 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9b8f501909273..35dccc2de393f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -19,12 +19,12 @@ PODS: - Airship/Core - AirshipFrameworkProxy (5.1.1): - Airship (= 17.7.3) - - AirshipServiceExtension (18.4.0) - - AppAuth (1.7.5): - - AppAuth/Core (= 1.7.5) - - AppAuth/ExternalUserAgent (= 1.7.5) - - AppAuth/Core (1.7.5) - - AppAuth/ExternalUserAgent (1.7.5): + - AirshipServiceExtension (17.8.0) + - AppAuth (1.6.2): + - AppAuth/Core (= 1.6.2) + - AppAuth/ExternalUserAgent (= 1.6.2) + - AppAuth/Core (1.6.2) + - AppAuth/ExternalUserAgent (1.6.2): - AppAuth/Core - boost (1.83.0) - BVLinearGradient (2.8.1): @@ -184,44 +184,44 @@ PODS: - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30911.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) - - GoogleSignIn (7.1.0): - - AppAuth (< 2.0, >= 1.7.3) - - GTMAppAuth (< 5.0, >= 4.1.1) - - GTMSessionFetcher/Core (~> 3.3) - - GoogleUtilities/AppDelegateSwizzler (7.13.3): + - GoogleSignIn (7.0.0): + - AppAuth (~> 1.5) + - GTMAppAuth (< 3.0, >= 1.3) + - GTMSessionFetcher/Core (< 4.0, >= 1.1) + - GoogleUtilities/AppDelegateSwizzler (7.13.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - GoogleUtilities/Privacy - - GoogleUtilities/Environment (7.13.3): + - GoogleUtilities/Environment (7.13.0): - GoogleUtilities/Privacy - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/ISASwizzler (7.13.3): + - GoogleUtilities/ISASwizzler (7.13.0): - GoogleUtilities/Privacy - - GoogleUtilities/Logger (7.13.3): + - GoogleUtilities/Logger (7.13.0): - GoogleUtilities/Environment - GoogleUtilities/Privacy - - GoogleUtilities/MethodSwizzler (7.13.3): + - GoogleUtilities/MethodSwizzler (7.13.0): - GoogleUtilities/Logger - GoogleUtilities/Privacy - - GoogleUtilities/Network (7.13.3): + - GoogleUtilities/Network (7.13.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Privacy - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (7.13.3)": + - "GoogleUtilities/NSData+zlib (7.13.0)": - GoogleUtilities/Privacy - - GoogleUtilities/Privacy (7.13.3) - - GoogleUtilities/Reachability (7.13.3): + - GoogleUtilities/Privacy (7.13.0) + - GoogleUtilities/Reachability (7.13.0): - GoogleUtilities/Logger - GoogleUtilities/Privacy - - GoogleUtilities/UserDefaults (7.13.3): + - GoogleUtilities/UserDefaults (7.13.0): - GoogleUtilities/Logger - GoogleUtilities/Privacy - - GTMAppAuth (4.1.1): - - AppAuth/Core (~> 1.7) - - GTMSessionFetcher/Core (< 4.0, >= 3.3) - - GTMSessionFetcher/Core (3.4.1) + - GTMAppAuth (2.0.0): + - AppAuth/Core (~> 1.6) + - GTMSessionFetcher/Core (< 4.0, >= 1.5) + - GTMSessionFetcher/Core (3.3.1) - hermes-engine (0.73.4): - hermes-engine/Pre-built (= 0.73.4) - hermes-engine/Pre-built (0.73.4) @@ -282,7 +282,7 @@ PODS: - nanopb/encode (= 2.30908.0) - nanopb/decode (2.30908.0) - nanopb/encode (2.30908.0) - - Onfido (29.7.2) + - Onfido (29.7.1) - onfido-react-native-sdk (10.6.0): - glog - hermes-engine @@ -1243,13 +1243,7 @@ PODS: - react-native-config (1.5.0): - react-native-config/App (= 1.5.0) - react-native-config/App (1.5.0): - - RCT-Folly - - RCTRequired - - RCTTypeSafety - - React - - React-Codegen - - React-RCTFabric - - ReactCommon/turbomodule/core + - React-Core - react-native-document-picker (9.1.1): - RCT-Folly - RCTRequired @@ -2485,8 +2479,8 @@ CHECKOUT OPTIONS: SPEC CHECKSUMS: Airship: 5a6d3f8a982398940b0d48423bb9b8736717c123 AirshipFrameworkProxy: 7255f4ed9836dc2920f2f1ea5657ced4cee8a35c - AirshipServiceExtension: 6216e677a5ef6f2bc365db95b0eeca1b905afde0 - AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa + AirshipServiceExtension: 0a5fb14c3fd1879355ab05a81d10f64512a4f79c + AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570 boost: d3f49c53809116a5d38da093a8aa78bf551aed09 BVLinearGradient: 421743791a59d259aec53f4c58793aad031da2ca DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953 @@ -2512,10 +2506,10 @@ SPEC CHECKSUMS: glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2 GoogleAppMeasurement: 5ba1164e3c844ba84272555e916d0a6d3d977e91 GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a - GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db - GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 - GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de - GTMSessionFetcher: 8000756fc1c19d2e5697b90311f7832d2e33f6cd + GoogleSignIn: b232380cf495a429b8095d3178a8d5855b42e842 + GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152 + GTMAppAuth: 99fb010047ba3973b7026e45393f51f27ab965ae + GTMSessionFetcher: 8a1b34ad97ebe6f909fb8b9b77fba99943007556 hermes-engine: b2669ce35fc4ac14f523b307aff8896799829fe2 libaom: 144606b1da4b5915a1054383c3a4459ccdb3c661 libavif: 84bbb62fb232c3018d6f1bab79beea87e35de7b7 @@ -2529,7 +2523,7 @@ SPEC CHECKSUMS: MapboxMaps: 87ef0003e6db46e45e7a16939f29ae87e38e7ce2 MapboxMobileEvents: de50b3a4de180dd129c326e09cd12c8adaaa46d6 nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 - Onfido: f3af62ea1c9a419589c133e3e511e5d2c4f3f8af + Onfido: 342cbecd7a4383e98dfe7f9c35e98aaece599062 onfido-react-native-sdk: 3e3b0dd70afa97410fb318d54c6a415137968ef2 Plaid: 7829e84db6d766a751c91a402702946d2977ddcb PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 @@ -2558,7 +2552,7 @@ SPEC CHECKSUMS: react-native-airship: 38e2596999242b68c933959d6145512e77937ac0 react-native-blob-util: 1ddace5234c62e3e6e4e154d305ad07ef686599b react-native-cameraroll: f373bebbe9f6b7c3fd2a6f97c5171cda574cf957 - react-native-config: 5ce986133b07fc258828b20b9506de0e683efc1c + react-native-config: 5330c8258265c1e5fdb8c009d2cabd6badd96727 react-native-document-picker: 8532b8af7c2c930f9e202aac484ac785b0f4f809 react-native-geolocation: f9e92eb774cb30ac1e099f34b3a94f03b4db7eb3 react-native-image-picker: f8a13ff106bcc7eb00c71ce11fdc36aac2a44440 @@ -2629,7 +2623,7 @@ SPEC CHECKSUMS: SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Turf: 13d1a92d969ca0311bbc26e8356cca178ce95da2 VisionCamera: 1394a316c7add37e619c48d7aa40b38b954bf055 - Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312 + Yoga: 64cd2a583ead952b0315d5135bf39e053ae9be70 PODFILE CHECKSUM: d5e281e5370cb0211a104efd90eb5fa7af936e14 From 6856ae3080323e6bb45d3f767cc73dc7b5513334 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Mon, 24 Jun 2024 12:07:17 +0200 Subject: [PATCH 12/26] update tests and remove depreacted messages --- tests/utils/collections/reportActions.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/utils/collections/reportActions.ts b/tests/utils/collections/reportActions.ts index 67dfdc10f00e8..d541c4cd4a213 100644 --- a/tests/utils/collections/reportActions.ts +++ b/tests/utils/collections/reportActions.ts @@ -26,18 +26,11 @@ const getRandomDate = (): string => { return formattedDate; }; -const deprecatedReportActions: ReportActionName[] = [ - CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, - CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED, - CONST.REPORT.ACTIONS.TYPE.DONATION, -]; - export default function createRandomReportAction(index: number): ReportAction { return { // we need to add any here because of the way we are generating random values // eslint-disable-next-line @typescript-eslint/no-explicit-any - actionName: rand(flattenActionNamesValues(CONST.REPORT.ACTIONS.TYPE).filter((actionType: ReportActionName) => !deprecatedReportActions.includes(actionType))) as any, + actionName: rand(flattenActionNamesValues(CONST.REPORT.ACTIONS.TYPE)) as any, reportActionID: index.toString(), previousReportActionID: (index === 0 ? 0 : index - 1).toString(), actorAccountID: index, From 4ce20e14017fc1c1eb64ca34b99c75ec0daff7ec Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Mon, 24 Jun 2024 12:14:39 +0200 Subject: [PATCH 13/26] remove utility function for checking modified fields --- src/libs/ReportUtils.ts | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 1e256e12ce998..87524dae427c7 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3154,28 +3154,6 @@ function getModifiedExpenseOriginalMessage( return originalMessage; } -const ORIGINAL_MESSAGE_FIELDS = ['comment', 'created', 'merchant', 'amount', 'currency', 'category', 'tag', 'taxCode', 'taxAmount', 'billable'] as const; - -/** - * Detect and return a modified field name based on the original message. - * - * At the moment, we only allow changing one transaction field at a time. - * @param originalMessage - */ -function getOriginalMessageModifiedField({originalMessage}: OriginalMessage): string { - if (typeof originalMessage !== 'object' || originalMessage === null) { - return ''; - } - - for (const field of ORIGINAL_MESSAGE_FIELDS) { - if (field in originalMessage) { - return field; - } - } - - return ''; -} - /** * Check if original message is an object and can be used as a ChangeLog type * @param originalMessage @@ -7302,7 +7280,6 @@ export { isDraftReport, changeMoneyRequestHoldStatus, createDraftWorkspaceAndNavigateToConfirmationScreen, - getOriginalMessageModifiedField, isChatUsedForOnboarding, getChatUsedForOnboarding, }; From 43a5ebd9c732758eb7f863eb8ba1a97c3c7c6eb5 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Mon, 24 Jun 2024 12:25:40 +0200 Subject: [PATCH 14/26] fix unused types --- src/libs/ReportUtils.ts | 2 +- src/types/onyx/OldDotOriginalMessage.ts | 146 ++++++++++-------------- 2 files changed, 60 insertions(+), 88 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 87524dae427c7..0a18b10b126f3 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -42,7 +42,7 @@ import type {Errors, Icon, PendingAction} from '@src/types/onyx/OnyxCommon'; import type {OriginalMessageChangeLog, PaymentMethodType} from '@src/types/onyx/OriginalMessage'; import type {Status} from '@src/types/onyx/PersonalDetails'; import type {NotificationPreference, Participants, PendingChatMember, Participant as ReportParticipant} from '@src/types/onyx/Report'; -import type {Message, OriginalMessage, ReportActions} from '@src/types/onyx/ReportAction'; +import type {Message, ReportActions} from '@src/types/onyx/ReportAction'; import type {Comment, Receipt, TransactionChanges, WaypointCollection} from '@src/types/onyx/Transaction'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; diff --git a/src/types/onyx/OldDotOriginalMessage.ts b/src/types/onyx/OldDotOriginalMessage.ts index 8b6711025717e..cc55b65e7ad82 100644 --- a/src/types/onyx/OldDotOriginalMessage.ts +++ b/src/types/onyx/OldDotOriginalMessage.ts @@ -1,20 +1,7 @@ -import type {ValueOf} from 'type-fest'; +import type { ValueOf } from 'type-fest'; import type CONST from '@src/CONST'; -import type { - ChangeFieldParams, - ChangePolicyParams, - ChangeTypeParams, - DelegateSubmitParams, - ExportedToIntegrationParams, - ForwardedParams, - IntegrationsMessageParams, - MarkedReimbursedParams, - MarkReimbursedFromIntegrationParams, - ShareParams, - StripePaidParams, - UnapprovedParams, - UnshareParams, -} from '@src/languages/types'; +import type { ChangeFieldParams, ChangePolicyParams, DelegateSubmitParams, ExportedToIntegrationParams, IntegrationsMessageParams, MarkReimbursedFromIntegrationParams, ShareParams, UnshareParams } from '@src/languages/types'; + /** * @@ -72,20 +59,17 @@ type OriginalMessageChangePolicy = { originalMessage: ChangePolicyParams & Record; }; -// verify -/** - * - */ -type OriginalMessageChangeType = { - /** - * - */ - actionName: typeof CONST.REPORT.ACTIONS.TYPE.CHANGE_TYPE; - /** - * - */ - originalMessage: ChangeTypeParams & Record; -}; +// Currently lacking Params +// type OriginalMessageChangeType = { +// /** +// * +// */ +// actionName: typeof CONST.REPORT.ACTIONS.TYPE.CHANGE_TYPE; +// /** +// * +// */ +// originalMessage: ChangeTypeParams & Record; +// }; /** * @@ -129,20 +113,17 @@ type OriginalMessageExportedToIntegration = { originalMessage: ExportedToIntegrationParams & Record; }; -// verify -/** - * - */ -type OriginalMessagePolicyTask = { - /** - * - */ - actionName: typeof CONST.REPORT.ACTIONS.TYPE.FORWARDED; - /** - * - */ - originalMessage: ForwardedParams & Record; -}; +// Currently lacking Params +// type OriginalMessagePolicyTask = { +// /** +// * +// */ +// actionName: typeof CONST.REPORT.ACTIONS.TYPE.FORWARDED; +// /** +// * +// */ +// originalMessage: ForwardedParams & Record; +// }; /** * @@ -186,20 +167,17 @@ type OriginalMessageManagerDetachReceipt = { originalMessage: Record; }; -// verify -/** - * - */ -type OriginalMessageMarkedReimbursed = { - /** - * - */ - actionName: typeof CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED; - /** - * - */ - originalMessage: MarkedReimbursedParams & Record; -}; +// Currently lacking Params +// type OriginalMessageMarkedReimbursed = { +// /** +// * +// */ +// actionName: typeof CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED; +// /** +// * +// */ +// originalMessage: MarkedReimbursedParams & Record; +// }; /** * @@ -327,20 +305,17 @@ type OriginalMessageUnshare = { originalMessage: UnshareParams & Record; }; -// verify -/** - * - */ -type OriginalMessageStripePaid = { - /** - * - */ - actionName: typeof CONST.REPORT.ACTIONS.TYPE.STRIPE_PAID; - /** - * - */ - originalMessage: StripePaidParams & Record; -}; +// Currently lacking Params +// type OriginalMessageStripePaid = { +// /** +// * +// */ +// actionName: typeof CONST.REPORT.ACTIONS.TYPE.STRIPE_PAID; +// /** +// * +// */ +// originalMessage: StripePaidParams & Record; +// }; /** * @@ -356,20 +331,17 @@ type OriginalMessageTakeControl = { originalMessage: Record; }; -// verify -/** - * - */ -type OriginalMessageUnapproved = { - /** - * - */ - actionName: typeof CONST.REPORT.ACTIONS.TYPE.UNAPPROVED; - /** - * - */ - originalMessage: UnapprovedParams & Record; -}; +// Currently lacking Params +// type OriginalMessageUnapproved = { +// /** +// * +// */ +// actionName: typeof CONST.REPORT.ACTIONS.TYPE.UNAPPROVED; +// /** +// * +// */ +// originalMessage: UnapprovedParams & Record; +// }; /** * @@ -476,4 +448,4 @@ export type { OriginalMessageUnshare, OriginalMessageTakeControl, OldDotOriginalMessageMap, -}; +}; \ No newline at end of file From 29792075148fceedd7bf49d01da956237de92ade Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Mon, 24 Jun 2024 16:00:07 +0200 Subject: [PATCH 15/26] run prettier --- src/types/onyx/OldDotOriginalMessage.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/types/onyx/OldDotOriginalMessage.ts b/src/types/onyx/OldDotOriginalMessage.ts index cc55b65e7ad82..610ff78d4514e 100644 --- a/src/types/onyx/OldDotOriginalMessage.ts +++ b/src/types/onyx/OldDotOriginalMessage.ts @@ -1,7 +1,15 @@ -import type { ValueOf } from 'type-fest'; +import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; -import type { ChangeFieldParams, ChangePolicyParams, DelegateSubmitParams, ExportedToIntegrationParams, IntegrationsMessageParams, MarkReimbursedFromIntegrationParams, ShareParams, UnshareParams } from '@src/languages/types'; - +import type { + ChangeFieldParams, + ChangePolicyParams, + DelegateSubmitParams, + ExportedToIntegrationParams, + IntegrationsMessageParams, + MarkReimbursedFromIntegrationParams, + ShareParams, + UnshareParams, +} from '@src/languages/types'; /** * @@ -448,4 +456,4 @@ export type { OriginalMessageUnshare, OriginalMessageTakeControl, OldDotOriginalMessageMap, -}; \ No newline at end of file +}; From a4f9d4f71b4bd62c09e674a6d6e9371f24aad58c Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Tue, 25 Jun 2024 11:16:07 +0200 Subject: [PATCH 16/26] add original message condition --- src/libs/ReportActionsUtils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 204fec860a245..fbdf35cf13262 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -192,6 +192,10 @@ function getWhisperedTo(reportAction: OnyxInputOrEntry): number[] const originalMessage = getOriginalMessage(reportAction); const message = reportAction?.message; + if (Array.isArray(originalMessage) && originalMessage.length === 0) { + return []; + } + if (!(originalMessage && 'whisperedTo' in originalMessage) && !(message && 'whisperedTo' in message)) { return []; } From fd87079ef59a7d5c1636db85df46c3d768e49933 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Wed, 26 Jun 2024 13:17:46 +0200 Subject: [PATCH 17/26] remove condition --- src/libs/ReportActionsUtils.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index fbdf35cf13262..204fec860a245 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -192,10 +192,6 @@ function getWhisperedTo(reportAction: OnyxInputOrEntry): number[] const originalMessage = getOriginalMessage(reportAction); const message = reportAction?.message; - if (Array.isArray(originalMessage) && originalMessage.length === 0) { - return []; - } - if (!(originalMessage && 'whisperedTo' in originalMessage) && !(message && 'whisperedTo' in message)) { return []; } From 5d652b6fd8fa0c80da1139df5b61f2811c88acc1 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Wed, 26 Jun 2024 13:41:20 +0200 Subject: [PATCH 18/26] review fixes --- src/CONST.ts | 6 ++++++ src/libs/ReportActionsUtils.ts | 23 ++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index f2354221d5c7a..01d329c2ed758 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -671,9 +671,12 @@ const CONST = { CLOSED: 'CLOSED', CREATED: 'CREATED', DELEGATE_SUBMIT: 'DELEGATESUBMIT', // OldDot Action + DELETED_ACCOUNT: 'DELETEDACCOUNT', // Deprecated OldDot Action DISMISSED_VIOLATION: 'DISMISSEDVIOLATION', + DONATION: 'DONATION', // Deprecated OldDot Action EXPORTED_TO_CSV: 'EXPORTCSV', // OldDot Action EXPORTED_TO_INTEGRATION: 'EXPORTINTEGRATION', // OldDot Action + EXPORTED_TO_QUICK_BOOKS: 'EXPORTED', // Deprecated OldDot Action FORWARDED: 'FORWARDED', // OldDot Action HOLD: 'HOLD', HOLD_COMMENT: 'HOLDCOMMENT', @@ -693,6 +696,9 @@ const CONST = { REIMBURSEMENT_DELAYED: 'REIMBURSEMENTDELAYED', // OldDot Action REIMBURSEMENT_QUEUED: 'REIMBURSEMENTQUEUED', REIMBURSEMENT_DEQUEUED: 'REIMBURSEMENTDEQUEUED', + REIMBURSEMENT_REQUESTED: 'REIMBURSEMENTREQUESTED', // Deprecated OldDot Action + REIMBURSEMENT_SETUP: 'REIMBURSEMENTSETUP', // Deprecated OldDot Action + REIMBURSEMENT_SETUP_REQUESTED: 'REIMBURSEMENTSETUPREQUESTED', // Deprecated OldDot Action RENAMED: 'RENAMED', REPORT_PREVIEW: 'REPORTPREVIEW', SELECTED_FOR_RANDOM_AUDIT: 'SELECTEDFORRANDOMAUDIT', // OldDot Action diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 204fec860a245..f4119e7e2fe2f 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -583,6 +583,17 @@ function isReportActionDeprecated(reportAction: OnyxEntry, key: st return true; } + const deprecatedOldDotReportActions: ReportActionName[] = [ + CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED, + CONST.REPORT.ACTIONS.TYPE.DONATION, + ]; + if (deprecatedOldDotReportActions.includes(reportAction.actionName)) { + Log.info('Front end filtered out reportAction for being an older, deprecated report action', false, reportAction); + return true; + } + return false; } @@ -1180,7 +1191,17 @@ function isOldDotReportAction(action: ReportAction | OldDotReportAction): action /** * Helper method to format message of OldDot Actions. */ -function getMessageOfOldDotReportAction({originalMessage, actionName}: OldDotOriginalMessage): string { +function getMessageOfOldDotReportAction({ + reportAction, + oldDotOriginalMessage: {actionName, originalMessage}, +}: { + reportAction: OnyxEntry; + oldDotOriginalMessage: OldDotOriginalMessage; +}): string { + if (!Array.isArray(reportAction?.message)) { + return getReportActionText(reportAction); + } + switch (actionName) { case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: { const {oldValue, newValue, fieldName} = originalMessage; From af11678785e44ef8be0956cdd94b1e362ba691ec Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Wed, 26 Jun 2024 16:54:57 +0200 Subject: [PATCH 19/26] modify conditions --- src/libs/ReportActionsUtils.ts | 131 ++++++++++-------- ...dDotOriginalMessage.ts => OldDotAction.ts} | 29 +++- src/types/onyx/OriginalMessage.ts | 11 +- src/types/onyx/ReportAction.ts | 10 +- 4 files changed, 106 insertions(+), 75 deletions(-) rename src/types/onyx/{OldDotOriginalMessage.ts => OldDotAction.ts} (96%) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 4e06293164f3e..05d79543823ae 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -8,7 +8,7 @@ import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; import type {OnyxInputOrEntry} from '@src/types/onyx'; -import type OldDotOriginalMessage from '@src/types/onyx/OldDotOriginalMessage'; +import type OldDotAction from '@src/types/onyx/OldDotAction'; import type {JoinWorkspaceResolution} from '@src/types/onyx/OriginalMessage'; import type Report from '@src/types/onyx/Report'; import type {Message, OldDotReportAction, OriginalMessage, ReportActions} from '@src/types/onyx/ReportAction'; @@ -1187,75 +1187,84 @@ function isOldDotReportAction(action: ReportAction | OldDotReportAction): action CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL, CONST.REPORT.ACTIONS.TYPE.UNAPPROVED, CONST.REPORT.ACTIONS.TYPE.UNSHARE, + CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, + CONST.REPORT.ACTIONS.TYPE.DONATION, + CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_QUICK_BOOKS, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP, ].some((oldDotActionName) => oldDotActionName === action.actionName); } -/** - * Helper method to format message of OldDot Actions. - */ -function getMessageOfOldDotReportAction({ - reportAction, - oldDotOriginalMessage: {actionName, originalMessage}, -}: { - reportAction: OnyxEntry; - oldDotOriginalMessage: OldDotOriginalMessage; -}): string { - if (!Array.isArray(reportAction?.message)) { - return getReportActionText(reportAction); - } else if (reportAction.message.length !== 0) { +function getMessageOfOldDotLegacyAction(legacyAction: PartialReportAction) { + if (!Array.isArray(legacyAction?.message)) { + return getReportActionText(legacyAction); + } + if (legacyAction.message.length !== 0) { // Sometime html can be an empty string // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - return reportAction?.message?.map((element) => getTextFromHtml(element?.html || element?.text)).join('') ?? ''; + return legacyAction?.message?.map((element) => getTextFromHtml(element?.html || element?.text)).join('') ?? ''; } + return ''; +} + +/** + * Helper method to format message of OldDot Actions. + */ +function getMessageOfOldDotReportAction(oldDotAction: OldDotAction): string { + const {originalMessage, actionName} = oldDotAction; - switch (actionName) { - case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: { - const {oldValue, newValue, fieldName} = originalMessage; + if (oldDotAction.originalMessage) { + switch (actionName) { + case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: { + const {oldValue, newValue, fieldName} = originalMessage; - return Localize.translateLocal('report.actions.type.changeField', {oldValue, newValue, fieldName}); - } - case CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY: { - const {fromPolicy, toPolicy} = originalMessage; - return Localize.translateLocal('report.actions.type.changePolicy', {fromPolicy, toPolicy}); - } - case CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT: { - const {delegateUser, originalManager} = originalMessage; - return Localize.translateLocal('report.actions.type.delegateSubmit', {delegateUser, originalManager}); - } - case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV: - return Localize.translateLocal('report.actions.type.exportedToCSV'); - case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION: - return Localize.translateLocal('report.actions.type.exportedToIntegration', {label: originalMessage.label}); - case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: - return Localize.translateLocal('report.actions.type.integrationsMessage', {errorMessage: originalMessage.errorMessage}); - case CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT: - return Localize.translateLocal('report.actions.type.managerAttachReceipt'); - case CONST.REPORT.ACTIONS.TYPE.MANAGER_DETACH_RECEIPT: - return Localize.translateLocal('report.actions.type.managerDetachReceipt'); - case CONST.REPORT.ACTIONS.TYPE.MARK_REIMBURSED_FROM_INTEGRATION: { - const {amount, currency} = originalMessage; - return Localize.translateLocal('report.actions.type.markedReimbursedFromIntegration', {amount, currency}); + return Localize.translateLocal('report.actions.type.changeField', {oldValue, newValue, fieldName}); + } + case CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY: { + const {fromPolicy, toPolicy} = originalMessage; + return Localize.translateLocal('report.actions.type.changePolicy', {fromPolicy, toPolicy}); + } + case CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT: { + const {delegateUser, originalManager} = originalMessage; + return Localize.translateLocal('report.actions.type.delegateSubmit', {delegateUser, originalManager}); + } + case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV: + return Localize.translateLocal('report.actions.type.exportedToCSV'); + case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION: + return Localize.translateLocal('report.actions.type.exportedToIntegration', {label: originalMessage.label}); + case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: + return Localize.translateLocal('report.actions.type.integrationsMessage', {errorMessage: originalMessage.errorMessage}); + case CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT: + return Localize.translateLocal('report.actions.type.managerAttachReceipt'); + case CONST.REPORT.ACTIONS.TYPE.MANAGER_DETACH_RECEIPT: + return Localize.translateLocal('report.actions.type.managerDetachReceipt'); + case CONST.REPORT.ACTIONS.TYPE.MARK_REIMBURSED_FROM_INTEGRATION: { + const {amount, currency} = originalMessage; + return Localize.translateLocal('report.actions.type.markedReimbursedFromIntegration', {amount, currency}); + } + case CONST.REPORT.ACTIONS.TYPE.OUTDATED_BANK_ACCOUNT: + return Localize.translateLocal('report.actions.type.outdatedBankAccount'); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_BOUNCE: + return Localize.translateLocal('report.actions.type.reimbursementACHBounce'); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_CANCELLED: + return Localize.translateLocal('report.actions.type.reimbursementACHCancelled'); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACCOUNT_CHANGED: + return Localize.translateLocal('report.actions.type.reimbursementAccountChanged'); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DELAYED: + return Localize.translateLocal('report.actions.type.reimbursementDelayed'); + case CONST.REPORT.ACTIONS.TYPE.SELECTED_FOR_RANDOM_AUDIT: + return Localize.translateLocal('report.actions.type.selectedForRandomAudit'); + case CONST.REPORT.ACTIONS.TYPE.SHARE: + return Localize.translateLocal('report.actions.type.share', {to: originalMessage.to}); + case CONST.REPORT.ACTIONS.TYPE.UNSHARE: + return Localize.translateLocal('report.actions.type.unshare', {to: originalMessage.to}); + case CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL: + return Localize.translateLocal('report.actions.type.takeControl'); + default: + return ''; } - case CONST.REPORT.ACTIONS.TYPE.OUTDATED_BANK_ACCOUNT: - return Localize.translateLocal('report.actions.type.outdatedBankAccount'); - case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_BOUNCE: - return Localize.translateLocal('report.actions.type.reimbursementACHBounce'); - case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_CANCELLED: - return Localize.translateLocal('report.actions.type.reimbursementACHCancelled'); - case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACCOUNT_CHANGED: - return Localize.translateLocal('report.actions.type.reimbursementAccountChanged'); - case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DELAYED: - return Localize.translateLocal('report.actions.type.reimbursementDelayed'); - case CONST.REPORT.ACTIONS.TYPE.SELECTED_FOR_RANDOM_AUDIT: - return Localize.translateLocal('report.actions.type.selectedForRandomAudit'); - case CONST.REPORT.ACTIONS.TYPE.SHARE: - return Localize.translateLocal('report.actions.type.share', {to: originalMessage.to}); - case CONST.REPORT.ACTIONS.TYPE.UNSHARE: - return Localize.translateLocal('report.actions.type.unshare', {to: originalMessage.to}); - case CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL: - return Localize.translateLocal('report.actions.type.takeControl'); - default: - return ''; + } else { + return getMessageOfOldDotLegacyAction(oldDotAction); } } diff --git a/src/types/onyx/OldDotOriginalMessage.ts b/src/types/onyx/OldDotAction.ts similarity index 96% rename from src/types/onyx/OldDotOriginalMessage.ts rename to src/types/onyx/OldDotAction.ts index 610ff78d4514e..66827eae4b6b7 100644 --- a/src/types/onyx/OldDotOriginalMessage.ts +++ b/src/types/onyx/OldDotAction.ts @@ -432,9 +432,33 @@ type OldDotOriginalMessageMap = { /** * */ -type OldDotOriginalMessage = ValueOf; +type OldDotLegacyMessage = { + /** + * + */ + html?: string; + /** + * + */ + text?: string; +}; + +/** + * + */ +type OldDotLegacyAction = { + /** + * + */ + message: OldDotLegacyMessage[] | OldDotLegacyMessage; +}; + +/** + * + */ +type OldDotAction = ValueOf; -export default OldDotOriginalMessage; +export default OldDotAction; export type { OriginalMessageChangeField, OldDotOriginalMessageActionName, @@ -456,4 +480,5 @@ export type { OriginalMessageUnshare, OriginalMessageTakeControl, OldDotOriginalMessageMap, + OldDotLegacyAction, }; diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 5edefa92191ca..dcbc030e6d4a2 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -1,8 +1,7 @@ import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; -import type AssertTypesEqual from '@src/types/utils/AssertTypesEqual'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; -import type {OldDotOriginalMessageMap} from './OldDotOriginalMessage'; +import type {OldDotOriginalMessageMap} from './OldDotAction'; import type ReportActionName from './ReportActionName'; /** Types of join workspace resolutions */ @@ -513,14 +512,6 @@ type OriginalMessageMap = { [T in ValueOf]: OriginalMessageChangeLog; }; -/** */ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -type AssertOriginalMessageDefinedForAllActions = AssertTypesEqual< - ReportActionName, - keyof OriginalMessageMap, - `Error: Types don't match, OriginalMessageMap type is missing: ${Exclude}` ->; - /** */ type OriginalMessage = OriginalMessageMap[T]; diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index 82115c79e4ec2..4b8bf2bda4f16 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -5,7 +5,7 @@ import type CONST from '@src/CONST'; import type ONYXKEYS from '@src/ONYXKEYS'; import type CollectionDataSet from '@src/types/utils/CollectionDataSet'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; -import type OldDotOriginalMessage from './OldDotOriginalMessage'; +import type OldDotAction from './OldDotAction'; import type * as OnyxCommon from './OnyxCommon'; import type OriginalMessage from './OriginalMessage'; import type {Decision} from './OriginalMessage'; @@ -270,7 +270,13 @@ type ReportActionBase = OnyxCommon.OnyxValueWithOfflineFeedback<{ /** * */ -type OldDotReportAction = ReportActionBase & OldDotOriginalMessage; +type OldDotReportAction = ReportActionBase & + OldDotAction & { + /** + * + */ + message?: (OriginalMessage & Message) | Array; + }; /** * From 9fdbcd64a1bfc7a809e49f76b6a2028c4badc578 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Wed, 26 Jun 2024 17:56:45 +0200 Subject: [PATCH 20/26] modify conditions --- src/libs/ReportActionsUtils.ts | 115 ++++++++++++++++++--------------- src/types/onyx/ReportAction.ts | 8 +-- 2 files changed, 63 insertions(+), 60 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index f4322cabca268..41cfa49018e7f 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1161,7 +1161,17 @@ function getMemberChangeMessageFragment(reportAction: OnyxEntry): }; } -function isOldDotReportAction(action: ReportAction | OldDotReportAction): action is OldDotReportAction { +function isOldDotLegacyAction(action: OldDotReportAction | PartialReportAction): action is PartialReportAction { + return [ + CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, + CONST.REPORT.ACTIONS.TYPE.DONATION, + CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_QUICK_BOOKS, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP, + ].some((oldDotActionName) => oldDotActionName === action?.actionName); +} + +function isOldDotReportAction(action: ReportAction | OldDotReportAction) { return [ CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD, CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY, @@ -1209,61 +1219,60 @@ function getMessageOfOldDotLegacyAction(legacyAction: PartialReportAction) { /** * Helper method to format message of OldDot Actions. */ -function getMessageOfOldDotReportAction(oldDotAction: OldDotAction): string { - const {originalMessage, actionName} = oldDotAction; +function getMessageOfOldDotReportAction(oldDotAction: PartialReportAction | OldDotAction): string { + if (isOldDotLegacyAction(oldDotAction)) { + return getMessageOfOldDotLegacyAction(oldDotAction); + } - if (oldDotAction.originalMessage) { - switch (actionName) { - case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: { - const {oldValue, newValue, fieldName} = originalMessage; + const {originalMessage, actionName} = oldDotAction; + switch (actionName) { + case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: { + const {oldValue, newValue, fieldName} = originalMessage; - return Localize.translateLocal('report.actions.type.changeField', {oldValue, newValue, fieldName}); - } - case CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY: { - const {fromPolicy, toPolicy} = originalMessage; - return Localize.translateLocal('report.actions.type.changePolicy', {fromPolicy, toPolicy}); - } - case CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT: { - const {delegateUser, originalManager} = originalMessage; - return Localize.translateLocal('report.actions.type.delegateSubmit', {delegateUser, originalManager}); - } - case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV: - return Localize.translateLocal('report.actions.type.exportedToCSV'); - case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION: - return Localize.translateLocal('report.actions.type.exportedToIntegration', {label: originalMessage.label}); - case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: - return Localize.translateLocal('report.actions.type.integrationsMessage', {errorMessage: originalMessage.errorMessage}); - case CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT: - return Localize.translateLocal('report.actions.type.managerAttachReceipt'); - case CONST.REPORT.ACTIONS.TYPE.MANAGER_DETACH_RECEIPT: - return Localize.translateLocal('report.actions.type.managerDetachReceipt'); - case CONST.REPORT.ACTIONS.TYPE.MARK_REIMBURSED_FROM_INTEGRATION: { - const {amount, currency} = originalMessage; - return Localize.translateLocal('report.actions.type.markedReimbursedFromIntegration', {amount, currency}); - } - case CONST.REPORT.ACTIONS.TYPE.OUTDATED_BANK_ACCOUNT: - return Localize.translateLocal('report.actions.type.outdatedBankAccount'); - case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_BOUNCE: - return Localize.translateLocal('report.actions.type.reimbursementACHBounce'); - case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_CANCELLED: - return Localize.translateLocal('report.actions.type.reimbursementACHCancelled'); - case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACCOUNT_CHANGED: - return Localize.translateLocal('report.actions.type.reimbursementAccountChanged'); - case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DELAYED: - return Localize.translateLocal('report.actions.type.reimbursementDelayed'); - case CONST.REPORT.ACTIONS.TYPE.SELECTED_FOR_RANDOM_AUDIT: - return Localize.translateLocal('report.actions.type.selectedForRandomAudit'); - case CONST.REPORT.ACTIONS.TYPE.SHARE: - return Localize.translateLocal('report.actions.type.share', {to: originalMessage.to}); - case CONST.REPORT.ACTIONS.TYPE.UNSHARE: - return Localize.translateLocal('report.actions.type.unshare', {to: originalMessage.to}); - case CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL: - return Localize.translateLocal('report.actions.type.takeControl'); - default: - return ''; + return Localize.translateLocal('report.actions.type.changeField', {oldValue, newValue, fieldName}); } - } else { - return getMessageOfOldDotLegacyAction(oldDotAction); + case CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY: { + const {fromPolicy, toPolicy} = originalMessage; + return Localize.translateLocal('report.actions.type.changePolicy', {fromPolicy, toPolicy}); + } + case CONST.REPORT.ACTIONS.TYPE.DELEGATE_SUBMIT: { + const {delegateUser, originalManager} = originalMessage; + return Localize.translateLocal('report.actions.type.delegateSubmit', {delegateUser, originalManager}); + } + case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_CSV: + return Localize.translateLocal('report.actions.type.exportedToCSV'); + case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION: + return Localize.translateLocal('report.actions.type.exportedToIntegration', {label: originalMessage.label}); + case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: + return Localize.translateLocal('report.actions.type.integrationsMessage', {errorMessage: originalMessage.errorMessage}); + case CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT: + return Localize.translateLocal('report.actions.type.managerAttachReceipt'); + case CONST.REPORT.ACTIONS.TYPE.MANAGER_DETACH_RECEIPT: + return Localize.translateLocal('report.actions.type.managerDetachReceipt'); + case CONST.REPORT.ACTIONS.TYPE.MARK_REIMBURSED_FROM_INTEGRATION: { + const {amount, currency} = originalMessage; + return Localize.translateLocal('report.actions.type.markedReimbursedFromIntegration', {amount, currency}); + } + case CONST.REPORT.ACTIONS.TYPE.OUTDATED_BANK_ACCOUNT: + return Localize.translateLocal('report.actions.type.outdatedBankAccount'); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_BOUNCE: + return Localize.translateLocal('report.actions.type.reimbursementACHBounce'); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACH_CANCELLED: + return Localize.translateLocal('report.actions.type.reimbursementACHCancelled'); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_ACCOUNT_CHANGED: + return Localize.translateLocal('report.actions.type.reimbursementAccountChanged'); + case CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DELAYED: + return Localize.translateLocal('report.actions.type.reimbursementDelayed'); + case CONST.REPORT.ACTIONS.TYPE.SELECTED_FOR_RANDOM_AUDIT: + return Localize.translateLocal('report.actions.type.selectedForRandomAudit'); + case CONST.REPORT.ACTIONS.TYPE.SHARE: + return Localize.translateLocal('report.actions.type.share', {to: originalMessage.to}); + case CONST.REPORT.ACTIONS.TYPE.UNSHARE: + return Localize.translateLocal('report.actions.type.unshare', {to: originalMessage.to}); + case CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL: + return Localize.translateLocal('report.actions.type.takeControl'); + default: + return ''; } } diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index ccbafe66b7d3b..d43151fe1d9cf 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -269,13 +269,7 @@ type ReportActionBase = OnyxCommon.OnyxValueWithOfflineFeedback<{ /** * */ -type OldDotReportAction = ReportActionBase & - OldDotAction & { - /** - * - */ - message?: (OriginalMessage & Message) | Array; - }; +type OldDotReportAction = ReportActionBase & OldDotAction; /** * From 32bdbe0108d716948cee77bd588c784bfeeeaf7a Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Wed, 26 Jun 2024 18:07:18 +0200 Subject: [PATCH 21/26] fix types --- src/libs/ReportActionsUtils.ts | 3 +-- src/types/onyx/OriginalMessage.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 41cfa49018e7f..66e0821c339b1 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -8,7 +8,6 @@ import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; import type {OnyxInputOrEntry} from '@src/types/onyx'; -import type OldDotAction from '@src/types/onyx/OldDotAction'; import type {JoinWorkspaceResolution} from '@src/types/onyx/OriginalMessage'; import type Report from '@src/types/onyx/Report'; import type {Message, OldDotReportAction, OriginalMessage, ReportActions} from '@src/types/onyx/ReportAction'; @@ -1219,7 +1218,7 @@ function getMessageOfOldDotLegacyAction(legacyAction: PartialReportAction) { /** * Helper method to format message of OldDot Actions. */ -function getMessageOfOldDotReportAction(oldDotAction: PartialReportAction | OldDotAction): string { +function getMessageOfOldDotReportAction(oldDotAction: PartialReportAction | OldDotReportAction): string { if (isOldDotLegacyAction(oldDotAction)) { return getMessageOfOldDotLegacyAction(oldDotAction); } diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index dcbc030e6d4a2..c7d9397f3202b 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -506,6 +506,22 @@ type OriginalMessageMap = { [CONST.REPORT.ACTIONS.TYPE.UPDATE_GROUP_CHAT_MEMBER_ROLE]: never; /** */ [CONST.REPORT.ACTIONS.TYPE.TRIPPREVIEW]: OriginalMessageTripRoomPreview; + /** */ + [CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED]: never; + /** */ + [CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP]: never; + /** */ + [CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_QUICK_BOOKS]: never; + /** */ + [CONST.REPORT.ACTIONS.TYPE.DONATION]: never; + /** */ + [CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT]: never; + /** */ + [CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED]: never; + /** */ + [CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP]: never; + /** */ + [CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED]: never; } & OldDotOriginalMessageMap & { [T in ValueOf]: OriginalMessageChangeLog; } & { From 7e7a294721ab18786a0fccb031bcff54ed8bf420 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Fri, 28 Jun 2024 12:13:11 +0200 Subject: [PATCH 22/26] add label to integrationsMessage --- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- src/languages/types.ts | 2 +- src/libs/ReportActionsUtils.ts | 6 ++++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 7137e7694b1e4..e11dd6c1ccfd8 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2993,7 +2993,7 @@ export default { exportedToIntegration: ({label}: ExportedToIntegrationParams) => `exported this report to ${label}`, forwarded: ({amount, currency}: ForwardedParams) => `approved ${currency}${amount}`, // verify errorMessage - integrationsMessage: ({errorMessage}: IntegrationsMessageParams) => `failed to export this report to NetSuite. ${errorMessage}`, + integrationsMessage: ({errorMessage, label}: IntegrationsMessageParams) => `failed to export this report to ${label}. ${errorMessage}`, managerAttachReceipt: `added a receipt`, managerDetachReceipt: `removed the receipt`, markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `paid ${currency}${amount} elsewhere`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 70cfdb894d283..be92d30ca4a72 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3033,7 +3033,7 @@ export default { exportedToIntegration: ({label}: ExportedToIntegrationParams) => `exportó este informe a ${label}`, forwarded: ({amount, currency}: ForwardedParams) => `aprobado ${currency}${amount}`, // verify errorMessage - integrationsMessage: ({errorMessage}: IntegrationsMessageParams) => `no se pudo exportar este informe a NetSuite. ${errorMessage}`, + integrationsMessage: ({errorMessage, label}: IntegrationsMessageParams) => `no se pudo exportar este informe a ${label}. ${errorMessage}`, managerAttachReceipt: `agregó un recibo`, managerDetachReceipt: `quitó el recibo`, markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `pagó ${currency}${amount} en otro lugar`, diff --git a/src/languages/types.ts b/src/languages/types.ts index fad5d24e231b7..7d0fd3ac22488 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -310,7 +310,7 @@ type ExportedToIntegrationParams = {label: string}; type ForwardedParams = {amount: string; currency: string}; -type IntegrationsMessageParams = {errorMessage: string}; +type IntegrationsMessageParams = {errorMessage: string; label: string}; type MarkedReimbursedParams = {amount: string; currency: string}; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 66e0821c339b1..c6176d1beb1e6 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1242,8 +1242,10 @@ function getMessageOfOldDotReportAction(oldDotAction: PartialReportAction | OldD return Localize.translateLocal('report.actions.type.exportedToCSV'); case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION: return Localize.translateLocal('report.actions.type.exportedToIntegration', {label: originalMessage.label}); - case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: - return Localize.translateLocal('report.actions.type.integrationsMessage', {errorMessage: originalMessage.errorMessage}); + case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: { + const {errorMessage, label} = originalMessage; + return Localize.translateLocal('report.actions.type.integrationsMessage', {errorMessage, label}); + } case CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT: return Localize.translateLocal('report.actions.type.managerAttachReceipt'); case CONST.REPORT.ACTIONS.TYPE.MANAGER_DETACH_RECEIPT: From ab51f36484e87565ccd88460ab9bfd67494175ae Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Fri, 28 Jun 2024 12:13:23 +0200 Subject: [PATCH 23/26] remove todo --- src/languages/en.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index e11dd6c1ccfd8..af8dd7f329e50 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2992,7 +2992,6 @@ export default { exportedToCSV: `exported this report to CSV`, exportedToIntegration: ({label}: ExportedToIntegrationParams) => `exported this report to ${label}`, forwarded: ({amount, currency}: ForwardedParams) => `approved ${currency}${amount}`, - // verify errorMessage integrationsMessage: ({errorMessage, label}: IntegrationsMessageParams) => `failed to export this report to ${label}. ${errorMessage}`, managerAttachReceipt: `added a receipt`, managerDetachReceipt: `removed the receipt`, From 98a4d0f697a24c2b9714f60604392405315807ca Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Fri, 28 Jun 2024 12:30:27 +0200 Subject: [PATCH 24/26] add condition for no field --- src/languages/en.ts | 1 + src/languages/es.ts | 2 +- src/languages/types.ts | 2 +- src/libs/ReportActionsUtils.ts | 4 +++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index d9e0964839b62..e77ccb6ddd5b3 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2997,6 +2997,7 @@ export default { actions: { type: { changeField: ({oldValue, newValue, fieldName}: ChangeFieldParams) => `changed ${fieldName} from ${oldValue} to ${newValue}`, + changeFieldEmpty: ({newValue, fieldName}: ChangeFieldParams) => `changed ${fieldName} to ${newValue}`, changePolicy: ({fromPolicy, toPolicy}: ChangePolicyParams) => `changed policy from ${fromPolicy} to ${toPolicy}`, changeType: ({oldType, newType}: ChangeTypeParams) => `changed type from ${oldType} to ${newType}`, delegateSubmit: ({delegateUser, originalManager}: DelegateSubmitParams) => `sent this report to ${delegateUser} since ${originalManager} is on vacation`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 88c2a1ca8c705..5526bc606e3a9 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3033,13 +3033,13 @@ export default { actions: { type: { changeField: ({oldValue, newValue, fieldName}: ChangeFieldParams) => `cambió ${fieldName} de ${oldValue} a ${newValue}`, + changeFieldEmpty: ({newValue, fieldName}: ChangeFieldParams) => `cambió ${fieldName} a ${newValue}`, changePolicy: ({fromPolicy, toPolicy}: ChangePolicyParams) => `cambió policy de ${fromPolicy} a ${toPolicy}`, changeType: ({oldType, newType}: ChangeTypeParams) => `cambió type de ${oldType} a ${newType}`, delegateSubmit: ({delegateUser, originalManager}: DelegateSubmitParams) => `envié este informe a ${delegateUser} ya que ${originalManager} está de vacaciones`, exportedToCSV: `exportó este informe a CSV`, exportedToIntegration: ({label}: ExportedToIntegrationParams) => `exportó este informe a ${label}`, forwarded: ({amount, currency}: ForwardedParams) => `aprobado ${currency}${amount}`, - // verify errorMessage integrationsMessage: ({errorMessage, label}: IntegrationsMessageParams) => `no se pudo exportar este informe a ${label}. ${errorMessage}`, managerAttachReceipt: `agregó un recibo`, managerDetachReceipt: `quitó el recibo`, diff --git a/src/languages/types.ts b/src/languages/types.ts index d9285fe0fcb87..eb90f2d9e0b21 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -298,7 +298,7 @@ type DistanceRateOperationsParams = {count: number}; type ReimbursementRateParams = {unit: Unit}; -type ChangeFieldParams = {oldValue: string; newValue: string; fieldName: string}; +type ChangeFieldParams = {oldValue?: string; newValue: string; fieldName: string}; type ChangePolicyParams = {fromPolicy: string; toPolicy: string}; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 252ab24f2c660..4b517ef5ebbdf 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1238,7 +1238,9 @@ function getMessageOfOldDotReportAction(oldDotAction: PartialReportAction | OldD switch (actionName) { case CONST.REPORT.ACTIONS.TYPE.CHANGE_FIELD: { const {oldValue, newValue, fieldName} = originalMessage; - + if (!oldValue) { + Localize.translateLocal('report.actions.type.changeFieldEmpty', {newValue, fieldName}); + } return Localize.translateLocal('report.actions.type.changeField', {oldValue, newValue, fieldName}); } case CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY: { From eb2550bfb11eababa4d438a30635b54f4ff7b2f6 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Sun, 30 Jun 2024 23:07:35 +0200 Subject: [PATCH 25/26] revert tests --- src/types/onyx/OriginalMessage.ts | 6 ++++++ tests/utils/collections/reportActions.ts | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index c7d9397f3202b..e619abf6cd81b 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -531,6 +531,11 @@ type OriginalMessageMap = { /** */ type OriginalMessage = OriginalMessageMap[T]; +/** + * + */ +type ActionName = DeepValueOf; + export default OriginalMessage; export type { DecisionName, @@ -543,4 +548,5 @@ export type { OriginalMessageChangeLog, JoinWorkspaceResolution, OriginalMessageModifiedExpense, + ActionName, }; diff --git a/tests/utils/collections/reportActions.ts b/tests/utils/collections/reportActions.ts index d541c4cd4a213..6fba8def2dde5 100644 --- a/tests/utils/collections/reportActions.ts +++ b/tests/utils/collections/reportActions.ts @@ -2,6 +2,7 @@ import {rand, randAggregation, randBoolean, randWord} from '@ngneat/falso'; import {format} from 'date-fns'; import CONST from '@src/CONST'; import type {ReportAction} from '@src/types/onyx'; +import type {ActionName} from '@src/types/onyx/OriginalMessage'; import type ReportActionName from '@src/types/onyx/ReportActionName'; import type DeepRecord from '@src/types/utils/DeepRecord'; @@ -26,11 +27,18 @@ const getRandomDate = (): string => { return formattedDate; }; +const deprecatedReportActions: ActionName[] = [ + CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, + CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED, + CONST.REPORT.ACTIONS.TYPE.DONATION, +] as const; + export default function createRandomReportAction(index: number): ReportAction { return { // we need to add any here because of the way we are generating random values // eslint-disable-next-line @typescript-eslint/no-explicit-any - actionName: rand(flattenActionNamesValues(CONST.REPORT.ACTIONS.TYPE)) as any, + actionName: rand(flattenActionNamesValues(CONST.REPORT.ACTIONS.TYPE).filter((actionType: ActionName) => !deprecatedReportActions.includes(actionType))) as any, reportActionID: index.toString(), previousReportActionID: (index === 0 ? 0 : index - 1).toString(), actorAccountID: index, From a65a680dd2b5de13c70812bae61345e221bd778f Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Sun, 30 Jun 2024 23:09:36 +0200 Subject: [PATCH 26/26] revert tests --- src/types/onyx/OriginalMessage.ts | 6 ------ tests/utils/collections/reportActions.ts | 5 ++--- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index e619abf6cd81b..c7d9397f3202b 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -531,11 +531,6 @@ type OriginalMessageMap = { /** */ type OriginalMessage = OriginalMessageMap[T]; -/** - * - */ -type ActionName = DeepValueOf; - export default OriginalMessage; export type { DecisionName, @@ -548,5 +543,4 @@ export type { OriginalMessageChangeLog, JoinWorkspaceResolution, OriginalMessageModifiedExpense, - ActionName, }; diff --git a/tests/utils/collections/reportActions.ts b/tests/utils/collections/reportActions.ts index 6fba8def2dde5..4836120a405bc 100644 --- a/tests/utils/collections/reportActions.ts +++ b/tests/utils/collections/reportActions.ts @@ -2,7 +2,6 @@ import {rand, randAggregation, randBoolean, randWord} from '@ngneat/falso'; import {format} from 'date-fns'; import CONST from '@src/CONST'; import type {ReportAction} from '@src/types/onyx'; -import type {ActionName} from '@src/types/onyx/OriginalMessage'; import type ReportActionName from '@src/types/onyx/ReportActionName'; import type DeepRecord from '@src/types/utils/DeepRecord'; @@ -27,7 +26,7 @@ const getRandomDate = (): string => { return formattedDate; }; -const deprecatedReportActions: ActionName[] = [ +const deprecatedReportActions: ReportActionName[] = [ CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT, CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED, CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED, @@ -38,7 +37,7 @@ export default function createRandomReportAction(index: number): ReportAction { return { // we need to add any here because of the way we are generating random values // eslint-disable-next-line @typescript-eslint/no-explicit-any - actionName: rand(flattenActionNamesValues(CONST.REPORT.ACTIONS.TYPE).filter((actionType: ActionName) => !deprecatedReportActions.includes(actionType))) as any, + actionName: rand(flattenActionNamesValues(CONST.REPORT.ACTIONS.TYPE).filter((actionType: ReportActionName) => !deprecatedReportActions.includes(actionType))) as any, reportActionID: index.toString(), previousReportActionID: (index === 0 ? 0 : index - 1).toString(), actorAccountID: index,