From dcc9ac9045009cb51b70a7029b4962371afe3a6c Mon Sep 17 00:00:00 2001 From: dominictb Date: Fri, 21 Jun 2024 17:44:36 +0700 Subject: [PATCH 01/16] fix: delete money request if failed to create chat Signed-off-by: dominictb --- .../ReportActionItem/MoneyRequestView.tsx | 5 + src/libs/actions/IOU.ts | 211 +++++++++++++++++- 2 files changed, 205 insertions(+), 11 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index dfcc1d363e72..8c520052f295 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -391,6 +391,11 @@ function MoneyRequestView({ if (!transaction?.transactionID) { return; } + if (report?.errorFields?.createChat && parentReportAction) { + const urlToNavigateBack = IOU.cleanUpMoneyRequest(transaction.transactionID, parentReportAction, true); + Navigation.goBack(urlToNavigateBack); + return; + } Transaction.clearError(transaction.transactionID); ReportActions.clearAllRelatedReportActionErrors(report.reportID, parentReportAction); }} diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 59fca7e502c3..d775b5ccb4f8 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -5265,7 +5265,14 @@ function updateMoneyRequestAmountAndCurrency({ API.write(WRITE_COMMANDS.UPDATE_MONEY_REQUEST_AMOUNT_AND_CURRENCY, params, onyxData); } -function deleteMoneyRequest(transactionID: string, reportAction: OnyxTypes.ReportAction, isSingleTransactionView = false) { +/** + * + * @param transactionID - The transactionID of IOU + * @param reportAction - The reportAction of the transaction in the IOU report + * @param isSingleTransactionView - whether we are in the transaction thread report + * @return the url to navigate back once the money request is deleted + */ +function prepareToCleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.ReportAction, isSingleTransactionView = false) { // STEP 1: Get all collections we're updating const iouReportID = reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? reportAction.originalMessage.IOUReportID : '-1'; const iouReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`] ?? null; @@ -5352,6 +5359,196 @@ function deleteMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repor updatedReportPreviewAction.childMoneyRequestCount = reportPreviewAction.childMoneyRequestCount - 1; } + let urlToNavigateBack: ReturnType | undefined; + + // STEP 7: Navigate the user depending on which page they are on and which resources were deleted + if (iouReport && isSingleTransactionView && shouldDeleteTransactionThread && !shouldDeleteIOUReport) { + // Pop the deleted report screen before navigating. This prevents navigating to the Concierge chat due to the missing report. + urlToNavigateBack = ROUTES.REPORT_WITH_ID.getRoute(iouReport.reportID); + } + + if (iouReport?.chatReportID && shouldDeleteIOUReport) { + // Pop the deleted report screen before navigating. This prevents navigating to the Concierge chat due to the missing report. + urlToNavigateBack = ROUTES.REPORT_WITH_ID.getRoute(iouReport.chatReportID); + } + + return { + shouldDeleteTransactionThread, + shouldDeleteIOUReport, + updatedReportAction, + updatedIOUReport, + updatedReportPreviewAction, + transactionThreadID, + transactionThread, + chatReport, + transaction, + transactionViolations, + reportPreviewAction, + iouReport, + urlToNavigateBack, + }; +} + +/** + * + * @param transactionID - The transactionID of IOU + * @param reportAction - The reportAction of the transaction in the IOU report + * @param isSingleTransactionView - whether we are in the transaction thread report + * @return the url to navigate back once the money request is deleted + */ +function cleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.ReportAction, isSingleTransactionView = false) { + const { + shouldDeleteTransactionThread, + shouldDeleteIOUReport, + updatedReportAction, + updatedIOUReport, + updatedReportPreviewAction, + transactionThreadID, + chatReport, + iouReport, + reportPreviewAction, + urlToNavigateBack, + } = prepareToCleanUpMoneyRequest(transactionID, reportAction, isSingleTransactionView); + + // build Onyx data + + // delete transaction + const onyxUpdates: OnyxUpdate[] = [ + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, + value: null, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`, + value: { + [reportAction.reportActionID]: shouldDeleteIOUReport + ? null + : { + pendingAction: null, + }, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport?.reportID}`, + value: { + [reportPreviewAction?.reportActionID ?? '-1']: { + pendingAction: null, + errors: null, + }, + }, + }, + ]; + + if (Permissions.canUseViolations(betas)) { + onyxUpdates.push({ + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`, + value: null, + }); + } + + if (shouldDeleteTransactionThread) { + onyxUpdates.push( + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadID}`, + value: null, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadID}`, + value: null, + }, + ); + } + + onyxUpdates.push( + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`, + value: updatedReportAction, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport?.reportID}`, + value: updatedIOUReport, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport?.reportID}`, + value: { + [reportPreviewAction?.reportActionID ?? '-1']: updatedReportPreviewAction, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport?.reportID}`, + value: ReportUtils.getOutstandingChildRequest(updatedIOUReport), + }, + ); + + if (!shouldDeleteIOUReport && updatedReportPreviewAction.childMoneyRequestCount === 0) { + onyxUpdates.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport?.reportID}`, + value: { + hasOutstandingChildRequest: false, + }, + }); + } + + if (shouldDeleteIOUReport) { + onyxUpdates.push( + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport?.reportID}`, + value: { + hasOutstandingChildRequest: false, + iouReportID: null, + lastMessageText: ReportActionsUtils.getLastVisibleMessage(iouReport?.chatReportID ?? '-1', {[reportPreviewAction?.reportActionID ?? '-1']: null})?.lastMessageText, + lastVisibleActionCreated: ReportActionsUtils.getLastVisibleAction(iouReport?.chatReportID ?? '-1', {[reportPreviewAction?.reportActionID ?? '-1']: null})?.created, + }, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport?.reportID}`, + value: null, + }, + ); + } + + Onyx.update(onyxUpdates); + + return urlToNavigateBack; +} + +/** + * + * @param transactionID - The transactionID of IOU + * @param reportAction - The reportAction of the transaction in the IOU report + * @param isSingleTransactionView - whether we are in the transaction thread report + * @return the url to navigate back once the money request is deleted + */ +function deleteMoneyRequest(transactionID: string, reportAction: OnyxTypes.ReportAction, isSingleTransactionView = false) { + const { + shouldDeleteTransactionThread, + shouldDeleteIOUReport, + updatedReportAction, + updatedIOUReport, + updatedReportPreviewAction, + transactionThreadID, + transactionThread, + chatReport, + transaction, + transactionViolations, + iouReport, + reportPreviewAction, + urlToNavigateBack, + } = prepareToCleanUpMoneyRequest(transactionID, reportAction, isSingleTransactionView); + // STEP 5: Build Onyx data const optimisticData: OnyxUpdate[] = [ { @@ -5557,16 +5754,7 @@ function deleteMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repor API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST, parameters, {optimisticData, successData, failureData}); CachedPDFPaths.clearByKey(transactionID); - // STEP 7: Navigate the user depending on which page they are on and which resources were deleted - if (iouReport && isSingleTransactionView && shouldDeleteTransactionThread && !shouldDeleteIOUReport) { - // Pop the deleted report screen before navigating. This prevents navigating to the Concierge chat due to the missing report. - return ROUTES.REPORT_WITH_ID.getRoute(iouReport.reportID); - } - - if (iouReport?.chatReportID && shouldDeleteIOUReport) { - // Pop the deleted report screen before navigating. This prevents navigating to the Concierge chat due to the missing report. - return ROUTES.REPORT_WITH_ID.getRoute(iouReport.chatReportID); - } + return urlToNavigateBack; } function deleteTrackExpense(chatReportID: string, transactionID: string, reportAction: OnyxTypes.ReportAction, isSingleTransactionView = false) { @@ -6983,6 +7171,7 @@ export { completeSplitBill, createDistanceRequest, createDraftTransaction, + cleanUpMoneyRequest, deleteMoneyRequest, deleteTrackExpense, detachReceipt, From ed0b37e566f9276575588859dce8104257f08809 Mon Sep 17 00:00:00 2001 From: dominictb Date: Fri, 21 Jun 2024 18:47:12 +0700 Subject: [PATCH 02/16] fix: add function to swap err message for local translation Signed-off-by: dominictb --- src/components/LocaleContextProvider.tsx | 8 +++++++- .../ReportActionItem/MoneyRequestView.tsx | 18 +++++++++++++----- src/libs/Localize/index.ts | 19 ++++++++++++++++++- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/components/LocaleContextProvider.tsx b/src/components/LocaleContextProvider.tsx index e0e30d14d2a2..f57a477b929e 100644 --- a/src/components/LocaleContextProvider.tsx +++ b/src/components/LocaleContextProvider.tsx @@ -30,6 +30,8 @@ type LocaleContextProps = { /** Returns translated string for given locale and phrase */ translate: (phraseKey: TKey, ...phraseParameters: Localize.PhraseParameters>) => string; + swapForTranslation: (message: string, messageLocale: Locale) => string; + /** Formats number formatted according to locale and options */ numberFormat: (number: number, options?: Intl.NumberFormatOptions) => string; @@ -69,6 +71,7 @@ const LocaleContext = createContext({ toLocaleDigit: () => '', toLocaleOrdinal: () => '', fromLocaleDigit: () => '', + swapForTranslation: () => '', preferredLocale: CONST.LOCALES.DEFAULT, }); @@ -105,9 +108,12 @@ function LocaleContextProvider({preferredLocale, currentUserPersonalDetails = {} const fromLocaleDigit = useMemo(() => (localeDigit) => LocaleDigitUtils.fromLocaleDigit(locale, localeDigit), [locale]); + const swapForTranslation = useMemo(() => (message, messageLocale) => Localize.swapForTranslation(locale, message, messageLocale), [locale]); + const contextValue = useMemo( () => ({ translate, + swapForTranslation, numberFormat, datetimeToRelative, datetimeToCalendarTime, @@ -118,7 +124,7 @@ function LocaleContextProvider({preferredLocale, currentUserPersonalDetails = {} fromLocaleDigit, preferredLocale: locale, }), - [translate, numberFormat, datetimeToRelative, datetimeToCalendarTime, updateLocale, formatPhoneNumber, toLocaleDigit, toLocaleOrdinal, fromLocaleDigit, locale], + [translate, swapForTranslation, numberFormat, datetimeToRelative, datetimeToCalendarTime, updateLocale, formatPhoneNumber, toLocaleDigit, toLocaleOrdinal, fromLocaleDigit, locale], ); return {children}; diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 8c520052f295..0ca400fe7122 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -100,7 +100,7 @@ function MoneyRequestView({ const styles = useThemeStyles(); const session = useSession(); const {isOffline} = useNetwork(); - const {translate, toLocaleDigit} = useLocalize(); + const {translate, toLocaleDigit, swapForTranslation} = useLocalize(); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const parentReportAction = parentReportActions?.[report.parentReportActionID ?? '-1'] ?? null; @@ -336,10 +336,18 @@ function MoneyRequestView({ const shouldShowNotesViolations = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report); const shouldShowReceiptHeader = isReceiptAllowed && (shouldShowReceiptEmptyState || hasReceipt); - const errors = { - ...(transaction?.errorFields?.route ?? transaction?.errors), - ...parentReportAction?.errors, - }; + const errors = useMemo(() => { + const combinedErrors = { + ...(transaction?.errorFields?.route ?? transaction?.errors), + ...parentReportAction?.errors, + }; + return Object.fromEntries( + Object.entries(combinedErrors).map(([key, value]) => + // swap for translation for each error message + [key, swapForTranslation(value as string, 'en')] + ), + ); + }, [transaction?.errorFields?.route, transaction?.errors, parentReportAction?.errors, swapForTranslation]); const tagList = policyTagLists.map(({name, orderWeight}, index) => { const tagError = getErrorForField( diff --git a/src/libs/Localize/index.ts b/src/libs/Localize/index.ts index c9eef3170245..fb0b21e5c150 100644 --- a/src/libs/Localize/index.ts +++ b/src/libs/Localize/index.ts @@ -225,5 +225,22 @@ function getDevicePreferredLocale(): Locale { return RNLocalize.findBestAvailableLanguage([CONST.LOCALES.EN, CONST.LOCALES.ES])?.languageTag ?? CONST.LOCALES.DEFAULT; } -export {translate, translateLocal, formatList, formatMessageElementList, getDevicePreferredLocale}; +/** + * This function match the message in the translation mapping and return the translation. + * @param locale - The locale to translate the message to. + * @param message - The message to translate. + * @param messageLocale - The locale of the message. + * @returns {string} - translation of the message or the original message if no translation found + */ +function swapForTranslation(locale: Locale, message: string, messageLocale: Locale): string { + const language = messageLocale.substring(0, 2) as 'en' | 'es'; + const matchedTranslationEntry = Object.entries(translations[language]).find(([, value]) => value === message) as [TranslationPaths, string] | undefined; + if (!matchedTranslationEntry) { + return message; + } + + return translate(locale, matchedTranslationEntry[0]); +} + +export {translate, translateLocal, formatList, formatMessageElementList, getDevicePreferredLocale, swapForTranslation}; export type {PhraseParameters, Phrase}; From 7936055bb58e7f55284ffd0b505619ba2aa3453a Mon Sep 17 00:00:00 2001 From: dominictb Date: Sat, 22 Jun 2024 15:29:08 +0700 Subject: [PATCH 03/16] fix: lint and prettier --- src/components/ReportActionItem/MoneyRequestView.tsx | 6 +++--- src/libs/Localize/index.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 3b9b2c2be183..b3aa40989ea8 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -355,9 +355,9 @@ function MoneyRequestView({ ...parentReportAction?.errors, }; return Object.fromEntries( - Object.entries(combinedErrors).map(([key, value]) => + Object.entries(combinedErrors).map(([key, value]) => // swap for translation for each error message - [key, swapForTranslation(value as string, 'en')] + [key, swapForTranslation(value as string, 'en')], ), ); }, [transaction?.errorFields?.route, transaction?.errors, parentReportAction?.errors, swapForTranslation]); @@ -417,7 +417,7 @@ function MoneyRequestView({ Navigation.goBack(urlToNavigateBack); return; } - + if (Object.values(transaction?.errors ?? {})?.find((error) => ErrorUtils.isReceiptError(error))) { deleteTransaction(parentReport, parentReportAction); } diff --git a/src/libs/Localize/index.ts b/src/libs/Localize/index.ts index fb0b21e5c150..d90d1ba75c09 100644 --- a/src/libs/Localize/index.ts +++ b/src/libs/Localize/index.ts @@ -230,7 +230,7 @@ function getDevicePreferredLocale(): Locale { * @param locale - The locale to translate the message to. * @param message - The message to translate. * @param messageLocale - The locale of the message. - * @returns {string} - translation of the message or the original message if no translation found + * @returns - translation of the message or the original message if no translation found */ function swapForTranslation(locale: Locale, message: string, messageLocale: Locale): string { const language = messageLocale.substring(0, 2) as 'en' | 'es'; From 68c4ca74fdf1468154394eaef66cca2ab7c4c22e Mon Sep 17 00:00:00 2001 From: dominictb Date: Mon, 24 Jun 2024 16:37:49 +0700 Subject: [PATCH 04/16] fix: check optimistic report before cleaning up money request Signed-off-by: dominictb --- src/components/ReportActionItem/MoneyRequestView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index b3aa40989ea8..456bbd2c6721 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -412,7 +412,7 @@ function MoneyRequestView({ if (!transaction?.transactionID) { return; } - if (report?.errorFields?.createChat && parentReportAction) { + if ((report?.errorFields?.createChat || report.isOptimisticReport) && parentReportAction) { const urlToNavigateBack = IOU.cleanUpMoneyRequest(transaction.transactionID, parentReportAction, true); Navigation.goBack(urlToNavigateBack); return; From 083c790b9df02433d5d471b3c8752b875d353f34 Mon Sep 17 00:00:00 2001 From: dominictb Date: Mon, 24 Jun 2024 16:45:26 +0700 Subject: [PATCH 05/16] chore: add translation Signed-off-by: dominictb --- src/languages/en.ts | 1 + src/languages/es.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index cced280d97df..a6793b8a9bac 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -754,6 +754,7 @@ export default { atLeastTwoDifferentWaypoints: 'Please enter at least two different addresses.', splitExpenseMultipleParticipantsErrorMessage: 'An expense cannot be split between a workspace and other members. Please update your selection.', invalidMerchant: 'Please enter a correct merchant.', + workspaceNotAccessible: 'The workspace is no longer accessible. Please try again on a different workspace.', }, waitingOnEnabledWallet: ({submitterDisplayName}: WaitingOnBankAccountParams) => `started settling up. Payment is on hold until ${submitterDisplayName} enables their wallet.`, enableWallet: 'Enable Wallet', diff --git a/src/languages/es.ts b/src/languages/es.ts index 2471450ad8d0..2c8986889e18 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -750,6 +750,7 @@ export default { atLeastTwoDifferentWaypoints: 'Por favor, introduce al menos dos direcciones diferentes.', splitExpenseMultipleParticipantsErrorMessage: 'Solo puedes dividir un gasto entre un único espacio de trabajo o con usuarios individuales. Por favor, actualiza tu selección.', invalidMerchant: 'Por favor, introduce un comerciante correcto.', + workspaceNotAccessible: 'El espacio de trabajo ya no está accesible. Por favor, intente de nuevo en un espacio de trabajo diferente.', }, waitingOnEnabledWallet: ({submitterDisplayName}: WaitingOnBankAccountParams) => `inició el pago, pero no se procesará hasta que ${submitterDisplayName} active tu billetera`, enableWallet: 'Habilitar Billetera', From 5951c3804c658619d05bff50fd1b788cb0571062 Mon Sep 17 00:00:00 2001 From: dominictb Date: Mon, 24 Jun 2024 16:52:44 +0700 Subject: [PATCH 06/16] fix: lint Signed-off-by: dominictb --- src/components/ReportActionItem/MoneyRequestView.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 456bbd2c6721..3d16ab720722 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -412,7 +412,8 @@ function MoneyRequestView({ if (!transaction?.transactionID) { return; } - if ((report?.errorFields?.createChat || report.isOptimisticReport) && parentReportAction) { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + if ((!!report?.errorFields?.createChat || !!report.isOptimisticReport) && parentReportAction) { const urlToNavigateBack = IOU.cleanUpMoneyRequest(transaction.transactionID, parentReportAction, true); Navigation.goBack(urlToNavigateBack); return; From b3833834aff35d25ccd08619dbcb9906ababf444 Mon Sep 17 00:00:00 2001 From: dominictb Date: Wed, 26 Jun 2024 19:00:08 +0700 Subject: [PATCH 07/16] fix: improve translation key swapping logic Signed-off-by: dominictb --- src/components/LocaleContextProvider.tsx | 4 ++-- .../ReportActionItem/MoneyRequestView.tsx | 2 +- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- src/languages/msgTranslationKeySwapMapping.ts | 8 ++++++++ src/libs/Localize/index.ts | 13 ++++++------- 6 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 src/languages/msgTranslationKeySwapMapping.ts diff --git a/src/components/LocaleContextProvider.tsx b/src/components/LocaleContextProvider.tsx index f57a477b929e..4a7d6061fdbc 100644 --- a/src/components/LocaleContextProvider.tsx +++ b/src/components/LocaleContextProvider.tsx @@ -30,7 +30,7 @@ type LocaleContextProps = { /** Returns translated string for given locale and phrase */ translate: (phraseKey: TKey, ...phraseParameters: Localize.PhraseParameters>) => string; - swapForTranslation: (message: string, messageLocale: Locale) => string; + swapForTranslation: (message: string) => string; /** Formats number formatted according to locale and options */ numberFormat: (number: number, options?: Intl.NumberFormatOptions) => string; @@ -108,7 +108,7 @@ function LocaleContextProvider({preferredLocale, currentUserPersonalDetails = {} const fromLocaleDigit = useMemo(() => (localeDigit) => LocaleDigitUtils.fromLocaleDigit(locale, localeDigit), [locale]); - const swapForTranslation = useMemo(() => (message, messageLocale) => Localize.swapForTranslation(locale, message, messageLocale), [locale]); + const swapForTranslation = useMemo(() => (message) => Localize.swapForTranslation(locale, message), [locale]); const contextValue = useMemo( () => ({ diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 59c1eca207a7..3a3f7736fb72 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -357,7 +357,7 @@ function MoneyRequestView({ return Object.fromEntries( Object.entries(combinedErrors).map(([key, value]) => // swap for translation for each error message - [key, swapForTranslation(value as string, 'en')], + [key, swapForTranslation(value as string)], ), ); }, [transaction?.errorFields?.route, transaction?.errors, parentReportAction?.errors, swapForTranslation]); diff --git a/src/languages/en.ts b/src/languages/en.ts index 8194037ef194..0e75bfc37c60 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -754,7 +754,7 @@ export default { atLeastTwoDifferentWaypoints: 'Please enter at least two different addresses.', splitExpenseMultipleParticipantsErrorMessage: 'An expense cannot be split between a workspace and other members. Please update your selection.', invalidMerchant: 'Please enter a correct merchant.', - workspaceNotAccessible: 'The workspace is no longer accessible. Please try again on a different workspace.', + workspaceNotAccessible: 'The workspace you selected is no longer accessible, possibly because it has been deleted or you no longer have access to it.', }, waitingOnEnabledWallet: ({submitterDisplayName}: WaitingOnBankAccountParams) => `started settling up. Payment is on hold until ${submitterDisplayName} enables their wallet.`, enableWallet: 'Enable Wallet', diff --git a/src/languages/es.ts b/src/languages/es.ts index 0b8ce0d6c31e..a69ebe085325 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -750,7 +750,7 @@ export default { atLeastTwoDifferentWaypoints: 'Por favor, introduce al menos dos direcciones diferentes.', splitExpenseMultipleParticipantsErrorMessage: 'Solo puedes dividir un gasto entre un único espacio de trabajo o con usuarios individuales. Por favor, actualiza tu selección.', invalidMerchant: 'Por favor, introduce un comerciante correcto.', - workspaceNotAccessible: 'El espacio de trabajo ya no está accesible. Por favor, intente de nuevo en un espacio de trabajo diferente.', + workspaceNotAccessible: 'El espacio de trabajo que seleccionaste ya no está accesible, posiblemente porque ha sido eliminado o ya no tienes acceso a él.', }, waitingOnEnabledWallet: ({submitterDisplayName}: WaitingOnBankAccountParams) => `inició el pago, pero no se procesará hasta que ${submitterDisplayName} active su billetera`, enableWallet: 'Habilitar Billetera', diff --git a/src/languages/msgTranslationKeySwapMapping.ts b/src/languages/msgTranslationKeySwapMapping.ts new file mode 100644 index 000000000000..6a9a9b336538 --- /dev/null +++ b/src/languages/msgTranslationKeySwapMapping.ts @@ -0,0 +1,8 @@ +const mapping: Record = { + // eslint-disable-next-line @typescript-eslint/naming-convention + 'The workspace is no longer accessible. Please try again on a different workspace.': 'iou.error.workspaceNotAccessible', + // eslint-disable-next-line @typescript-eslint/naming-convention + 'Unexpected error submitting this expense. Please try again later.': 'iou.error.genericCreateFailureMessage', +}; + +export default mapping; diff --git a/src/libs/Localize/index.ts b/src/libs/Localize/index.ts index d90d1ba75c09..5d19b19d5bae 100644 --- a/src/libs/Localize/index.ts +++ b/src/libs/Localize/index.ts @@ -5,6 +5,7 @@ import Log from '@libs/Log'; import type {MessageElementBase, MessageTextElement} from '@libs/MessageElement'; import Config from '@src/CONFIG'; import CONST from '@src/CONST'; +import msgTranslationKeySwapMapping from '@src/languages/msgTranslationKeySwapMapping'; import translations from '@src/languages/translations'; import type {TranslationFlatObject, TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -232,14 +233,12 @@ function getDevicePreferredLocale(): Locale { * @param messageLocale - The locale of the message. * @returns - translation of the message or the original message if no translation found */ -function swapForTranslation(locale: Locale, message: string, messageLocale: Locale): string { - const language = messageLocale.substring(0, 2) as 'en' | 'es'; - const matchedTranslationEntry = Object.entries(translations[language]).find(([, value]) => value === message) as [TranslationPaths, string] | undefined; - if (!matchedTranslationEntry) { - return message; +function swapForTranslation(locale: Locale, message: string): string { + const translationKey: string | undefined = msgTranslationKeySwapMapping[message]; + if (translationKey) { + return translate(locale, translationKey as TranslationPaths); } - - return translate(locale, matchedTranslationEntry[0]); + return message; } export {translate, translateLocal, formatList, formatMessageElementList, getDevicePreferredLocale, swapForTranslation}; From 65bd81d8f95a0a4bbcc9d718e3813b535ccb268d Mon Sep 17 00:00:00 2001 From: dominictb Date: Fri, 28 Jun 2024 09:41:09 +0700 Subject: [PATCH 08/16] fix: comment --- src/libs/Localize/index.ts | 1 - src/libs/actions/IOU.ts | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/libs/Localize/index.ts b/src/libs/Localize/index.ts index 5d19b19d5bae..87764fb73aeb 100644 --- a/src/libs/Localize/index.ts +++ b/src/libs/Localize/index.ts @@ -230,7 +230,6 @@ function getDevicePreferredLocale(): Locale { * This function match the message in the translation mapping and return the translation. * @param locale - The locale to translate the message to. * @param message - The message to translate. - * @param messageLocale - The locale of the message. * @returns - translation of the message or the original message if no translation found */ function swapForTranslation(locale: Locale, message: string): string { diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index f72d82fd5ae1..6b397f39e725 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -5369,7 +5369,8 @@ function prepareToCleanUpMoneyRequest(transactionID: string, reportAction: OnyxT let urlToNavigateBack: ReturnType | undefined; - // STEP 7: Navigate the user depending on which page they are on and which resources were deleted + // STEP 5: Calculate what is the url that we will navigate user back + // This depends on which page they are on and which resources were deleted if (iouReport && isSingleTransactionView && shouldDeleteTransactionThread && !shouldDeleteIOUReport) { // Pop the deleted report screen before navigating. This prevents navigating to the Concierge chat due to the missing report. urlToNavigateBack = ROUTES.REPORT_WITH_ID.getRoute(iouReport.reportID); @@ -5420,7 +5421,7 @@ function cleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repo // build Onyx data - // delete transaction + // Onyx operations to delete the transaction, update the IOU report action and chat report action const onyxUpdates: OnyxUpdate[] = [ { onyxMethod: Onyx.METHOD.SET, @@ -5450,6 +5451,7 @@ function cleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repo }, ]; + // added the operation to delete associated transaction violations if (Permissions.canUseViolations(betas)) { onyxUpdates.push({ onyxMethod: Onyx.METHOD.SET, @@ -5458,6 +5460,7 @@ function cleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repo }); } + // added the operation to delete transaction thread if (shouldDeleteTransactionThread) { onyxUpdates.push( { @@ -5473,6 +5476,7 @@ function cleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repo ); } + // added operations to update IOU report and chat report onyxUpdates.push( { onyxMethod: Onyx.METHOD.MERGE, @@ -5541,6 +5545,7 @@ function cleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repo * @return the url to navigate back once the money request is deleted */ function deleteMoneyRequest(transactionID: string, reportAction: OnyxTypes.ReportAction, isSingleTransactionView = false) { + // STEP 1: Calculate and prepare the data const { shouldDeleteTransactionThread, shouldDeleteIOUReport, @@ -5557,7 +5562,8 @@ function deleteMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repor urlToNavigateBack, } = prepareToCleanUpMoneyRequest(transactionID, reportAction, isSingleTransactionView); - // STEP 5: Build Onyx data + // STEP 2: Build Onyx data + // The logic mostly resembles the cleanUpMoneyRequest function const optimisticData: OnyxUpdate[] = [ { onyxMethod: Onyx.METHOD.SET, @@ -5758,7 +5764,7 @@ function deleteMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repor reportActionID: reportAction.reportActionID, }; - // STEP 6: Make the API request + // STEP 3: Make the API request API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST, parameters, {optimisticData, successData, failureData}); CachedPDFPaths.clearByKey(transactionID); From 041bed4abe7222837fe7d858167eca7c6c84a5d5 Mon Sep 17 00:00:00 2001 From: dominictb Date: Thu, 4 Jul 2024 11:49:38 +0700 Subject: [PATCH 09/16] fix: set errors and IOUTransactionID to null when deleting report action of IOU report in cleanUpMoneyRequest function Signed-off-by: dominictb --- src/libs/actions/IOU.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 6d6f2a0c3112..6b1b3351b3ac 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -1,6 +1,6 @@ import {format} from 'date-fns'; import {fastMerge, Str} from 'expensify-common'; -import type {OnyxCollection, OnyxEntry, OnyxInputValue, OnyxUpdate} from 'react-native-onyx'; +import type {NullishDeep, OnyxCollection, OnyxEntry, OnyxInputValue, OnyxUpdate} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import ReceiptGeneric from '@assets/images/receipt-generic.png'; @@ -5317,11 +5317,11 @@ function prepareToCleanUpMoneyRequest(transactionID: string, reportAction: OnyxT }, ], originalMessage: { - IOUTransactionID: undefined, + IOUTransactionID: null, }, - errors: undefined, + errors: null, }, - } as OnyxTypes.ReportActions; + } as NullishDeep; const lastVisibleAction = ReportActionsUtils.getLastVisibleAction(iouReport?.reportID ?? '-1', updatedReportAction); const iouReportLastMessageText = ReportActionsUtils.getLastVisibleMessage(iouReport?.reportID ?? '-1', updatedReportAction).lastMessageText; From 41768f415f9c61bcc279469e9988c0915728b36a Mon Sep 17 00:00:00 2001 From: dominictb Date: Thu, 4 Jul 2024 15:08:50 +0700 Subject: [PATCH 10/16] fix: typescript issue Signed-off-by: dominictb --- src/libs/actions/IOU.ts | 59 +++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 6b1b3351b3ac..2d749392a226 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -1,8 +1,3 @@ -import {format} from 'date-fns'; -import {fastMerge, Str} from 'expensify-common'; -import type {NullishDeep, OnyxCollection, OnyxEntry, OnyxInputValue, OnyxUpdate} from 'react-native-onyx'; -import Onyx from 'react-native-onyx'; -import type {ValueOf} from 'type-fest'; import ReceiptGeneric from '@assets/images/receipt-generic.png'; import * as API from '@libs/API'; import type { @@ -26,14 +21,14 @@ import type { TrackExpenseParams, UpdateMoneyRequestParams, } from '@libs/API/parameters'; -import {WRITE_COMMANDS} from '@libs/API/types'; +import { WRITE_COMMANDS } from '@libs/API/types'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import DateUtils from '@libs/DateUtils'; import DistanceRequestUtils from '@libs/DistanceRequestUtils'; import * as ErrorUtils from '@libs/ErrorUtils'; import * as FileUtils from '@libs/fileDownload/FileUtils'; import * as IOUUtils from '@libs/IOUUtils'; -import {toLocaleDigit} from '@libs/LocaleDigitUtils'; +import { toLocaleDigit } from '@libs/LocaleDigitUtils'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; import * as Localize from '@libs/Localize'; import Navigation from '@libs/Navigation/Navigation'; @@ -42,24 +37,29 @@ import Permissions from '@libs/Permissions'; import * as PhoneNumber from '@libs/PhoneNumber'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; -import type {OptimisticChatReport, OptimisticCreatedReportAction, OptimisticIOUReportAction, TransactionDetails} from '@libs/ReportUtils'; +import type { OptimisticChatReport, OptimisticCreatedReportAction, OptimisticIOUReportAction, TransactionDetails } from '@libs/ReportUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as SubscriptionUtils from '@libs/SubscriptionUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; import ViolationsUtils from '@libs/Violations/ViolationsUtils'; -import type {IOUAction, IOUType} from '@src/CONST'; +import type { IOUAction, IOUType } from '@src/CONST'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; -import type {Participant, Split} from '@src/types/onyx/IOU'; -import type {ErrorFields, Errors} from '@src/types/onyx/OnyxCommon'; -import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; +import type { Participant, Split } from '@src/types/onyx/IOU'; +import type { ErrorFields, Errors } from '@src/types/onyx/OnyxCommon'; +import type { PaymentMethodType } from '@src/types/onyx/OriginalMessage'; import type ReportAction from '@src/types/onyx/ReportAction'; -import type {OnyxData} from '@src/types/onyx/Request'; -import type {Comment, Receipt, ReceiptSource, Routes, SplitShares, TransactionChanges, WaypointCollection} from '@src/types/onyx/Transaction'; +import type { OnyxData } from '@src/types/onyx/Request'; +import type { Comment, Receipt, ReceiptSource, Routes, SplitShares, TransactionChanges, WaypointCollection } from '@src/types/onyx/Transaction'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; -import {isEmptyObject} from '@src/types/utils/EmptyObject'; +import { isEmptyObject } from '@src/types/utils/EmptyObject'; +import { format } from 'date-fns'; +import { fastMerge, Str } from 'expensify-common'; +import type { OnyxCollection, OnyxEntry, OnyxInputValue, OnyxUpdate } from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type { ValueOf } from 'type-fest'; import * as CachedPDFPaths from './CachedPDFPaths'; import * as Category from './Policy/Category'; import * as Policy from './Policy/Policy'; @@ -5321,7 +5321,7 @@ function prepareToCleanUpMoneyRequest(transactionID: string, reportAction: OnyxT }, errors: null, }, - } as NullishDeep; + } as unknown as OnyxTypes.ReportActions; const lastVisibleAction = ReportActionsUtils.getLastVisibleAction(iouReport?.reportID ?? '-1', updatedReportAction); const iouReportLastMessageText = ReportActionsUtils.getLastVisibleMessage(iouReport?.reportID ?? '-1', updatedReportAction).lastMessageText; @@ -7209,31 +7209,37 @@ function getIOURequestPolicyID(transaction: OnyxEntry, re } export { + adjustRemainingSplitShares, approveMoneyRequest, canApproveIOU, - canIOUBePaid, cancelPayment, + canIOUBePaid, + cleanUpMoneyRequest, clearMoneyRequest, completeSplitBill, createDistanceRequest, createDraftTransaction, - cleanUpMoneyRequest, deleteMoneyRequest, deleteTrackExpense, detachReceipt, + dismissHoldUseExplanation, editMoneyRequest, + getIOURequestPolicyID, initMoneyRequest, navigateToStartStepIfScanFileCannotBeRead, - payMoneyRequest, payInvoice, + payMoneyRequest, putOnHold, replaceReceipt, requestMoney, + resetSplitShares, savePreferredPaymentMethod, + sendInvoice, sendMoneyElsewhere, sendMoneyWithWallet, setCustomUnitRateID, setDraftSplitTransaction, + setIndividualShare, setMoneyRequestAmount, setMoneyRequestBillable, setMoneyRequestCategory, @@ -7245,16 +7251,11 @@ export { setMoneyRequestParticipantsFromReport, setMoneyRequestPendingFields, setMoneyRequestReceipt, - setSplitPayer, setMoneyRequestTag, setMoneyRequestTaxAmount, setMoneyRequestTaxRate, - dismissHoldUseExplanation, - updateMoneyRequestDate, + setSplitPayer, setSplitShares, - resetSplitShares, - setIndividualShare, - adjustRemainingSplitShares, splitBill, splitBillAndOpenReport, startMoneyRequest, @@ -7266,13 +7267,13 @@ export { updateMoneyRequestAmountAndCurrency, updateMoneyRequestBillable, updateMoneyRequestCategory, + updateMoneyRequestDate, updateMoneyRequestDescription, updateMoneyRequestDistance, updateMoneyRequestMerchant, updateMoneyRequestTag, updateMoneyRequestTaxAmount, - updateMoneyRequestTaxRate, - sendInvoice, - getIOURequestPolicyID, + updateMoneyRequestTaxRate }; -export type {GPSPoint as GpsPoint, IOURequestType}; +export type { GPSPoint as GpsPoint, IOURequestType }; + From 059063215c31ca135645ceae6fcdd4a8c413b650 Mon Sep 17 00:00:00 2001 From: dominictb Date: Wed, 10 Jul 2024 17:26:33 +0700 Subject: [PATCH 11/16] fix: resolve typescript issues Signed-off-by: dominictb --- src/libs/actions/IOU.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 3b7c6e10d4b4..a2621bb6d160 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -5308,6 +5308,7 @@ function updateMoneyRequestAmountAndCurrency({ */ function prepareToCleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.ReportAction, isSingleTransactionView = false) { // STEP 1: Get all collections we're updating + const allReports = ReportConnection.getAllReports(); const iouReportID = ReportActionsUtils.isMoneyRequestAction(reportAction) ? ReportActionsUtils.getOriginalMessage(reportAction)?.IOUReportID : '-1'; const iouReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`] ?? null; const chatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${iouReport?.chatReportID}`]; From 21eafea9e61f81ae96a85970df95b5ee27e5160f Mon Sep 17 00:00:00 2001 From: dominictb Date: Wed, 10 Jul 2024 17:53:37 +0700 Subject: [PATCH 12/16] fix: prettier Signed-off-by: dominictb --- src/libs/actions/IOU.ts | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index a2621bb6d160..262688d6889c 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -1,3 +1,8 @@ +import {format} from 'date-fns'; +import {fastMerge, Str} from 'expensify-common'; +import type {OnyxCollection, OnyxEntry, OnyxInputValue, OnyxUpdate} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import ReceiptGeneric from '@assets/images/receipt-generic.png'; import * as API from '@libs/API'; import type { @@ -22,14 +27,14 @@ import type { UnapproveExpenseReportParams, UpdateMoneyRequestParams, } from '@libs/API/parameters'; -import { WRITE_COMMANDS } from '@libs/API/types'; +import {WRITE_COMMANDS} from '@libs/API/types'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import DateUtils from '@libs/DateUtils'; import DistanceRequestUtils from '@libs/DistanceRequestUtils'; import * as ErrorUtils from '@libs/ErrorUtils'; import * as FileUtils from '@libs/fileDownload/FileUtils'; import * as IOUUtils from '@libs/IOUUtils'; -import { toLocaleDigit } from '@libs/LocaleDigitUtils'; +import {toLocaleDigit} from '@libs/LocaleDigitUtils'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; import * as Localize from '@libs/Localize'; import Navigation from '@libs/Navigation/Navigation'; @@ -44,24 +49,19 @@ import * as ReportUtils from '@libs/ReportUtils'; import * as SubscriptionUtils from '@libs/SubscriptionUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; import ViolationsUtils from '@libs/Violations/ViolationsUtils'; -import type { IOUAction, IOUType } from '@src/CONST'; +import type {IOUAction, IOUType} from '@src/CONST'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; -import type { Participant, Split } from '@src/types/onyx/IOU'; -import type { ErrorFields, Errors } from '@src/types/onyx/OnyxCommon'; -import type { PaymentMethodType } from '@src/types/onyx/OriginalMessage'; +import type {Participant, Split} from '@src/types/onyx/IOU'; +import type {ErrorFields, Errors} from '@src/types/onyx/OnyxCommon'; +import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; import type ReportAction from '@src/types/onyx/ReportAction'; -import type { OnyxData } from '@src/types/onyx/Request'; -import type { Comment, Receipt, ReceiptSource, Routes, SplitShares, TransactionChanges, WaypointCollection } from '@src/types/onyx/Transaction'; +import type {OnyxData} from '@src/types/onyx/Request'; +import type {Comment, Receipt, ReceiptSource, Routes, SplitShares, TransactionChanges, WaypointCollection} from '@src/types/onyx/Transaction'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; -import { isEmptyObject } from '@src/types/utils/EmptyObject'; -import { format } from 'date-fns'; -import { fastMerge, Str } from 'expensify-common'; -import type { OnyxCollection, OnyxEntry, OnyxInputValue, OnyxUpdate } from 'react-native-onyx'; -import Onyx from 'react-native-onyx'; -import type { ValueOf } from 'type-fest'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; import * as CachedPDFPaths from './CachedPDFPaths'; import * as Category from './Policy/Category'; import * as Policy from './Policy/Policy'; @@ -7389,7 +7389,6 @@ export { updateMoneyRequestMerchant, updateMoneyRequestTag, updateMoneyRequestTaxAmount, - updateMoneyRequestTaxRate + updateMoneyRequestTaxRate, }; -export type { GPSPoint as GpsPoint, IOURequestType }; - +export type {GPSPoint as GpsPoint, IOURequestType}; From 3730797ef95fa21d21bd4600bcc0ca07a29bd21f Mon Sep 17 00:00:00 2001 From: dominictb Date: Fri, 12 Jul 2024 16:36:18 +0700 Subject: [PATCH 13/16] fix: update comments and clean up implementation Signed-off-by: dominictb --- .../ReportActionItem/MoneyRequestView.tsx | 4 +- src/libs/ReportActionsUtils.ts | 100 +++++++++--------- src/libs/actions/IOU.ts | 76 ++++++------- 3 files changed, 88 insertions(+), 92 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 3a3f7736fb72..2a2f565dfdb4 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -412,8 +412,8 @@ function MoneyRequestView({ if (!transaction?.transactionID) { return; } - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - if ((!!report?.errorFields?.createChat || !!report.isOptimisticReport) && parentReportAction) { + const isCreateChatErrored = !!report?.errorFields?.createChat; + if ((isCreateChatErrored || !!report.isOptimisticReport) && parentReportAction) { const urlToNavigateBack = IOU.cleanUpMoneyRequest(transaction.transactionID, parentReportAction, true); Navigation.goBack(urlToNavigateBack); return; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 3f8acd0e06fe..e96c59592a37 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1,7 +1,7 @@ import {fastMerge} from 'expensify-common'; import _ from 'lodash'; import lodashFindLast from 'lodash/findLast'; -import type {OnyxCollection, OnyxCollectionInputValue, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; +import type {NullishDeep, OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; @@ -10,8 +10,8 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type {OnyxInputOrEntry} from '@src/types/onyx'; 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'; import type ReportAction from '@src/types/onyx/ReportAction'; +import type {Message, OldDotReportAction, OriginalMessage, ReportActions} from '@src/types/onyx/ReportAction'; import type ReportActionName from '@src/types/onyx/ReportActionName'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import DateUtils from './DateUtils'; @@ -663,10 +663,12 @@ function replaceBaseURLInPolicyChangeLogAction(reportAction: ReportAction): Repo return updatedReportAction; } -function getLastVisibleAction(reportID: string, actionsToMerge: OnyxCollection | OnyxCollectionInputValue = {}): OnyxEntry { +function getLastVisibleAction(reportID: string, actionsToMerge: Record | null> = {}): OnyxEntry { let reportActions: Array = []; if (!_.isEmpty(actionsToMerge)) { - reportActions = Object.values(fastMerge(allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`] ?? {}, actionsToMerge ?? {}, true)); + reportActions = Object.values(fastMerge(allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`] ?? {}, actionsToMerge ?? {}, true)) as Array< + ReportAction | null | undefined + >; } else { reportActions = Object.values(allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`] ?? {}); } @@ -680,7 +682,7 @@ function getLastVisibleAction(reportID: string, actionsToMerge: OnyxCollection | OnyxCollectionInputValue = {}, + actionsToMerge: Record | null> = {}, reportAction: OnyxInputOrEntry | undefined = undefined, ): LastVisibleMessage { const lastVisibleAction = reportAction ?? getLastVisibleAction(reportID, actionsToMerge); @@ -1397,90 +1399,90 @@ function getTrackExpenseActionableWhisper(transactionID: string, chatReportID: s } export { + doesReportHaveVisibleActions, extractLinksFromMessageHtml, + getActionableMentionWhisperMessage, + getAllReportActions, + getCombinedReportActions, getDismissedViolationMessageText, - getOneTransactionThreadReportID, + getFilteredForOneTransactionView, + getFirstVisibleReportActionID, + getIOUActionForReportID, getIOUReportIDFromReportActionPreview, getLastClosedReportAction, getLastVisibleAction, getLastVisibleMessage, getLatestReportActionFromOnyxData, getLinkedTransactionID, + getMemberChangeMessageFragment, + getMemberChangeMessagePlainText, + getMessageOfOldDotReportAction, getMostRecentIOURequestActionID, getMostRecentReportActionLastModified, getNumberOfMoneyRequests, + getOneTransactionThreadReportID, + getOriginalMessage, getParentReportAction, getReportAction, + getReportActionHtml, + getReportActionMessage, getReportActionMessageText, - getWhisperedTo, - isApprovedOrSubmittedReportAction, + getReportActionText, getReportPreviewAction, getSortedReportActions, - getCombinedReportActions, getSortedReportActionsForDisplay, + getTextFromHtml, + getTrackExpenseActionableWhisper, + getWhisperedTo, + hasRequestFromCurrentAccount, + isActionOfType, + isActionableJoinRequest, + isActionableJoinRequestPending, + isActionableMentionWhisper, + isActionableReportMentionWhisper, + isActionableTrackExpense, + isAddCommentAction, + isApprovedOrSubmittedReportAction, + isChronosOOOListAction, + isClosedAction, isConsecutiveActionMadeByPreviousActor, isCreatedAction, isCreatedTaskReportAction, + isCurrentActionUnread, isDeletedAction, isDeletedParentAction, + isLinkedTransactionHeld, + isMemberChangeAction, isMessageDeleted, isModifiedExpenseAction, isMoneyRequestAction, isNotifiableReportAction, + isOldDotReportAction, + isPayAction, isPendingRemove, - isReversedTransaction, + isPolicyChangeLogAction, + isReimbursementDeQueuedAction, + isReimbursementQueuedAction, + isRenamedAction, isReportActionAttachment, isReportActionDeprecated, isReportPreviewAction, + isResolvedActionTrackExpense, + isReversedTransaction, + isRoomChangeLogAction, isSentMoneyReportAction, isSplitBillAction, - isTrackExpenseAction, - isPayAction, isTaskAction, - doesReportHaveVisibleActions, isThreadParentMessage, + isTrackExpenseAction, isTransactionThread, + isTripPreview, isWhisperAction, isWhisperActionTargetedToOthers, - isReimbursementQueuedAction, - shouldReportActionBeVisible, shouldHideNewMarker, + shouldReportActionBeVisible, shouldReportActionBeVisibleAsLastAction, - hasRequestFromCurrentAccount, - getFirstVisibleReportActionID, - isMemberChangeAction, - getMemberChangeMessageFragment, - isOldDotReportAction, - getTrackExpenseActionableWhisper, - getMessageOfOldDotReportAction, - getMemberChangeMessagePlainText, - isReimbursementDeQueuedAction, - isActionableMentionWhisper, - isActionableReportMentionWhisper, - getActionableMentionWhisperMessage, - isCurrentActionUnread, - isActionableJoinRequest, - isActionableJoinRequestPending, - getReportActionText, - getReportActionHtml, - getReportActionMessage, - getOriginalMessage, - isActionOfType, - isActionableTrackExpense, - getAllReportActions, - isLinkedTransactionHeld, wasActionTakenByCurrentUser, - isResolvedActionTrackExpense, - isClosedAction, - isRenamedAction, - isRoomChangeLogAction, - isChronosOOOListAction, - isAddCommentAction, - isPolicyChangeLogAction, - getTextFromHtml, - isTripPreview, - getIOUActionForReportID, - getFilteredForOneTransactionView, }; export type {LastVisibleMessage}; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 262688d6889c..cf9c8c8a901b 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -1,8 +1,3 @@ -import {format} from 'date-fns'; -import {fastMerge, Str} from 'expensify-common'; -import type {OnyxCollection, OnyxEntry, OnyxInputValue, OnyxUpdate} from 'react-native-onyx'; -import Onyx from 'react-native-onyx'; -import type {ValueOf} from 'type-fest'; import ReceiptGeneric from '@assets/images/receipt-generic.png'; import * as API from '@libs/API'; import type { @@ -27,14 +22,14 @@ import type { UnapproveExpenseReportParams, UpdateMoneyRequestParams, } from '@libs/API/parameters'; -import {WRITE_COMMANDS} from '@libs/API/types'; +import { WRITE_COMMANDS } from '@libs/API/types'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import DateUtils from '@libs/DateUtils'; import DistanceRequestUtils from '@libs/DistanceRequestUtils'; import * as ErrorUtils from '@libs/ErrorUtils'; import * as FileUtils from '@libs/fileDownload/FileUtils'; import * as IOUUtils from '@libs/IOUUtils'; -import {toLocaleDigit} from '@libs/LocaleDigitUtils'; +import { toLocaleDigit } from '@libs/LocaleDigitUtils'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; import * as Localize from '@libs/Localize'; import Navigation from '@libs/Navigation/Navigation'; @@ -44,24 +39,29 @@ import * as PhoneNumber from '@libs/PhoneNumber'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportConnection from '@libs/ReportConnection'; -import type {OptimisticChatReport, OptimisticCreatedReportAction, OptimisticIOUReportAction, TransactionDetails} from '@libs/ReportUtils'; +import type { OptimisticChatReport, OptimisticCreatedReportAction, OptimisticIOUReportAction, TransactionDetails } from '@libs/ReportUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as SubscriptionUtils from '@libs/SubscriptionUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; import ViolationsUtils from '@libs/Violations/ViolationsUtils'; -import type {IOUAction, IOUType} from '@src/CONST'; +import type { IOUAction, IOUType } from '@src/CONST'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; -import type {Participant, Split} from '@src/types/onyx/IOU'; -import type {ErrorFields, Errors} from '@src/types/onyx/OnyxCommon'; -import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; +import type { Participant, Split } from '@src/types/onyx/IOU'; +import type { ErrorFields, Errors } from '@src/types/onyx/OnyxCommon'; +import type { PaymentMethodType } from '@src/types/onyx/OriginalMessage'; import type ReportAction from '@src/types/onyx/ReportAction'; -import type {OnyxData} from '@src/types/onyx/Request'; -import type {Comment, Receipt, ReceiptSource, Routes, SplitShares, TransactionChanges, WaypointCollection} from '@src/types/onyx/Transaction'; +import type { OnyxData } from '@src/types/onyx/Request'; +import type { Comment, Receipt, ReceiptSource, Routes, SplitShares, TransactionChanges, WaypointCollection } from '@src/types/onyx/Transaction'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; -import {isEmptyObject} from '@src/types/utils/EmptyObject'; +import { isEmptyObject } from '@src/types/utils/EmptyObject'; +import { format } from 'date-fns'; +import { fastMerge, Str } from 'expensify-common'; +import type { NullishDeep, OnyxCollection, OnyxEntry, OnyxInputValue, OnyxUpdate } from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; +import type { ValueOf } from 'type-fest'; import * as CachedPDFPaths from './CachedPDFPaths'; import * as Category from './Policy/Category'; import * as Policy from './Policy/Policy'; @@ -5347,7 +5347,7 @@ function prepareToCleanUpMoneyRequest(transactionID: string, reportAction: OnyxT }, errors: null, }, - } as unknown as OnyxTypes.ReportActions; + } as Record>; const lastVisibleAction = ReportActionsUtils.getLastVisibleAction(iouReport?.reportID ?? '-1', updatedReportAction); const iouReportLastMessageText = ReportActionsUtils.getLastVisibleMessage(iouReport?.reportID ?? '-1', updatedReportAction).lastMessageText; @@ -5400,20 +5400,19 @@ function prepareToCleanUpMoneyRequest(transactionID: string, reportAction: OnyxT updatedReportPreviewAction.childMoneyRequestCount = reportPreviewAction.childMoneyRequestCount - 1; } - let urlToNavigateBack: ReturnType | undefined; - - // STEP 5: Calculate what is the url that we will navigate user back + // STEP 5: Calculate the url that the user will be navigated back to // This depends on which page they are on and which resources were deleted + let reportIDToNavigateBack: string | undefined; if (iouReport && isSingleTransactionView && shouldDeleteTransactionThread && !shouldDeleteIOUReport) { - // Pop the deleted report screen before navigating. This prevents navigating to the Concierge chat due to the missing report. - urlToNavigateBack = ROUTES.REPORT_WITH_ID.getRoute(iouReport.reportID); + reportIDToNavigateBack = iouReport.reportID; } if (iouReport?.chatReportID && shouldDeleteIOUReport) { - // Pop the deleted report screen before navigating. This prevents navigating to the Concierge chat due to the missing report. - urlToNavigateBack = ROUTES.REPORT_WITH_ID.getRoute(iouReport.chatReportID); + reportIDToNavigateBack = iouReport.chatReportID; } + const urlToNavigateBack = reportIDToNavigateBack ? ROUTES.REPORT_WITH_ID.getRoute(reportIDToNavigateBack) : undefined; + return { shouldDeleteTransactionThread, shouldDeleteIOUReport, @@ -5472,17 +5471,21 @@ function cleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repo }, }, }, - { + ]; + + if (reportPreviewAction?.reportActionID) { + onyxUpdates.push({ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport?.reportID}`, value: { - [reportPreviewAction?.reportActionID ?? '-1']: { + [reportPreviewAction.reportActionID]: { + ...updatedReportPreviewAction, pendingAction: null, errors: null, }, }, - }, - ]; + }); + } // added the operation to delete associated transaction violations if (Permissions.canUseViolations(betas)) { @@ -5521,13 +5524,6 @@ function cleanUpMoneyRequest(transactionID: string, reportAction: OnyxTypes.Repo key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport?.reportID}`, value: updatedIOUReport, }, - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport?.reportID}`, - value: { - [reportPreviewAction?.reportActionID ?? '-1']: updatedReportPreviewAction, - }, - }, { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport?.reportID}`, @@ -7325,9 +7321,7 @@ function getIOURequestPolicyID(transaction: OnyxEntry, re export { adjustRemainingSplitShares, - approveMoneyRequest, - unapproveExpenseReport, - canApproveIOU, + approveMoneyRequest, canApproveIOU, cancelPayment, canIOUBePaid, cleanUpMoneyRequest, @@ -7377,8 +7371,7 @@ export { startMoneyRequest, startSplitBill, submitReport, - trackExpense, - unholdRequest, + trackExpense, unapproveExpenseReport, unholdRequest, updateDistanceRequestRate, updateMoneyRequestAmountAndCurrency, updateMoneyRequestBillable, @@ -7389,6 +7382,7 @@ export { updateMoneyRequestMerchant, updateMoneyRequestTag, updateMoneyRequestTaxAmount, - updateMoneyRequestTaxRate, + updateMoneyRequestTaxRate }; -export type {GPSPoint as GpsPoint, IOURequestType}; +export type { GPSPoint as GpsPoint, IOURequestType }; + From 4b79f389683dbc31f72d4636836959ca7e3e39f1 Mon Sep 17 00:00:00 2001 From: dominictb Date: Tue, 16 Jul 2024 09:12:24 +0700 Subject: [PATCH 14/16] fix: revert "swapForTranslation" change Signed-off-by: dominictb --- src/components/LocaleContextProvider.tsx | 8 +------- .../ReportActionItem/MoneyRequestView.tsx | 18 +++++------------- src/languages/msgTranslationKeySwapMapping.ts | 8 -------- src/libs/Localize/index.ts | 17 +---------------- 4 files changed, 7 insertions(+), 44 deletions(-) delete mode 100644 src/languages/msgTranslationKeySwapMapping.ts diff --git a/src/components/LocaleContextProvider.tsx b/src/components/LocaleContextProvider.tsx index 24e27d1715b5..322a68ffe32a 100644 --- a/src/components/LocaleContextProvider.tsx +++ b/src/components/LocaleContextProvider.tsx @@ -30,8 +30,6 @@ type LocaleContextProps = { /** Returns translated string for given locale and phrase */ translate: (phraseKey: TKey, ...phraseParameters: Localize.PhraseParameters>) => string; - swapForTranslation: (message: string) => string; - /** Formats number formatted according to locale and options */ numberFormat: (number: number, options?: Intl.NumberFormatOptions) => string; @@ -71,7 +69,6 @@ const LocaleContext = createContext({ toLocaleDigit: () => '', toLocaleOrdinal: () => '', fromLocaleDigit: () => '', - swapForTranslation: () => '', preferredLocale: CONST.LOCALES.DEFAULT, }); @@ -108,12 +105,9 @@ function LocaleContextProvider({preferredLocale, currentUserPersonalDetails, chi const fromLocaleDigit = useMemo(() => (localeDigit) => LocaleDigitUtils.fromLocaleDigit(locale, localeDigit), [locale]); - const swapForTranslation = useMemo(() => (message) => Localize.swapForTranslation(locale, message), [locale]); - const contextValue = useMemo( () => ({ translate, - swapForTranslation, numberFormat, datetimeToRelative, datetimeToCalendarTime, @@ -124,7 +118,7 @@ function LocaleContextProvider({preferredLocale, currentUserPersonalDetails, chi fromLocaleDigit, preferredLocale: locale, }), - [translate, swapForTranslation, numberFormat, datetimeToRelative, datetimeToCalendarTime, updateLocale, formatPhoneNumber, toLocaleDigit, toLocaleOrdinal, fromLocaleDigit, locale], + [translate, numberFormat, datetimeToRelative, datetimeToCalendarTime, updateLocale, formatPhoneNumber, toLocaleDigit, toLocaleOrdinal, fromLocaleDigit, locale], ); return {children}; diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index a00577fbdf8c..16d20853aa09 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -114,7 +114,7 @@ function MoneyRequestView({ const styles = useThemeStyles(); const session = useSession(); const {isOffline} = useNetwork(); - const {translate, toLocaleDigit, swapForTranslation} = useLocalize(); + const {translate, toLocaleDigit} = useLocalize(); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${parentReport?.parentReportID}`, { selector: (chatReportValue) => chatReportValue && {reportID: chatReportValue.reportID, errorFields: chatReportValue.errorFields}, @@ -355,18 +355,10 @@ function MoneyRequestView({ !isReceiptBeingScanned && hasReceipt && !!(receiptViolations.length || didReceiptScanSucceed) && !!canUseViolations && ReportUtils.isPaidGroupPolicy(report); const shouldShowReceiptAudit = isReceiptAllowed && (shouldShowReceiptEmptyState || hasReceipt); - const errors = useMemo(() => { - const combinedErrors = { - ...(transaction?.errorFields?.route ?? transaction?.errors), - ...parentReportAction?.errors, - }; - return Object.fromEntries( - Object.entries(combinedErrors).map(([key, value]) => - // swap for translation for each error message - [key, swapForTranslation(value as string)], - ), - ); - }, [transaction?.errorFields?.route, transaction?.errors, parentReportAction?.errors, swapForTranslation]); + const errors = { + ...(transaction?.errorFields?.route ?? transaction?.errors), + ...parentReportAction?.errors, + }; const tagList = policyTagLists.map(({name, orderWeight}, index) => { const tagError = getErrorForField( diff --git a/src/languages/msgTranslationKeySwapMapping.ts b/src/languages/msgTranslationKeySwapMapping.ts deleted file mode 100644 index 6a9a9b336538..000000000000 --- a/src/languages/msgTranslationKeySwapMapping.ts +++ /dev/null @@ -1,8 +0,0 @@ -const mapping: Record = { - // eslint-disable-next-line @typescript-eslint/naming-convention - 'The workspace is no longer accessible. Please try again on a different workspace.': 'iou.error.workspaceNotAccessible', - // eslint-disable-next-line @typescript-eslint/naming-convention - 'Unexpected error submitting this expense. Please try again later.': 'iou.error.genericCreateFailureMessage', -}; - -export default mapping; diff --git a/src/libs/Localize/index.ts b/src/libs/Localize/index.ts index 87764fb73aeb..c9eef3170245 100644 --- a/src/libs/Localize/index.ts +++ b/src/libs/Localize/index.ts @@ -5,7 +5,6 @@ import Log from '@libs/Log'; import type {MessageElementBase, MessageTextElement} from '@libs/MessageElement'; import Config from '@src/CONFIG'; import CONST from '@src/CONST'; -import msgTranslationKeySwapMapping from '@src/languages/msgTranslationKeySwapMapping'; import translations from '@src/languages/translations'; import type {TranslationFlatObject, TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -226,19 +225,5 @@ function getDevicePreferredLocale(): Locale { return RNLocalize.findBestAvailableLanguage([CONST.LOCALES.EN, CONST.LOCALES.ES])?.languageTag ?? CONST.LOCALES.DEFAULT; } -/** - * This function match the message in the translation mapping and return the translation. - * @param locale - The locale to translate the message to. - * @param message - The message to translate. - * @returns - translation of the message or the original message if no translation found - */ -function swapForTranslation(locale: Locale, message: string): string { - const translationKey: string | undefined = msgTranslationKeySwapMapping[message]; - if (translationKey) { - return translate(locale, translationKey as TranslationPaths); - } - return message; -} - -export {translate, translateLocal, formatList, formatMessageElementList, getDevicePreferredLocale, swapForTranslation}; +export {translate, translateLocal, formatList, formatMessageElementList, getDevicePreferredLocale}; export type {PhraseParameters, Phrase}; From 6ea8fc6e49c2c6a88f30eca101358d8c8665c684 Mon Sep 17 00:00:00 2001 From: Dominic <165644294+dominictb@users.noreply.github.com> Date: Wed, 17 Jul 2024 18:47:03 +0700 Subject: [PATCH 15/16] Remove en translation messsage Co-authored-by: Sobit Neupane <073bct543.sobit@pcampus.edu.np> --- src/languages/en.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index ff6b62cc27b7..b431531bc854 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -787,7 +787,6 @@ export default { atLeastTwoDifferentWaypoints: 'Please enter at least two different addresses.', splitExpenseMultipleParticipantsErrorMessage: 'An expense cannot be split between a workspace and other members. Please update your selection.', invalidMerchant: 'Please enter a correct merchant.', - workspaceNotAccessible: 'The workspace you selected is no longer accessible, possibly because it has been deleted or you no longer have access to it.', }, waitingOnEnabledWallet: ({submitterDisplayName}: WaitingOnBankAccountParams) => `started settling up. Payment is on hold until ${submitterDisplayName} enables their wallet.`, enableWallet: 'Enable wallet', From d71f595f81b501a7c29745797b94acc14facdca1 Mon Sep 17 00:00:00 2001 From: Dominic <165644294+dominictb@users.noreply.github.com> Date: Wed, 17 Jul 2024 18:47:42 +0700 Subject: [PATCH 16/16] Remove es translation message Co-authored-by: Sobit Neupane <073bct543.sobit@pcampus.edu.np> --- src/languages/es.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index ede5e7c6391c..6c5841e2a7d6 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -785,7 +785,6 @@ export default { atLeastTwoDifferentWaypoints: 'Por favor, introduce al menos dos direcciones diferentes.', splitExpenseMultipleParticipantsErrorMessage: 'Solo puedes dividir un gasto entre un único espacio de trabajo o con miembros individuales. Por favor, actualiza tu selección.', invalidMerchant: 'Por favor, introduce un comerciante correcto.', - workspaceNotAccessible: 'El espacio de trabajo que seleccionaste ya no está accesible, posiblemente porque ha sido eliminado o ya no tienes acceso a él.', }, waitingOnEnabledWallet: ({submitterDisplayName}: WaitingOnBankAccountParams) => `inició el pago, pero no se procesará hasta que ${submitterDisplayName} active su billetera`, enableWallet: 'Habilitar billetera',