From 536edac303e2b58051c2ca9fdfe9e95e53e599cd Mon Sep 17 00:00:00 2001 From: Aldo Canepa Date: Fri, 1 Dec 2023 16:58:55 -0800 Subject: [PATCH 1/3] Add validation error for category --- src/components/MoneyRequestConfirmationList.js | 5 ++++- src/languages/en.ts | 1 + src/languages/es.ts | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 1b4967a9c54c..7fb618cdf0eb 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -448,7 +448,10 @@ function MoneyRequestConfirmationList(props) { if (_.isEmpty(selectedParticipants)) { return; } - + if (props.iouCategory && props.iouCategory.length > CONST.API_TRANSACTION_CATEGORY_MAX_LENGTH) { + setFormError('iou.error.invalidCategoryLength'); + return; + } if (props.iouType === CONST.IOU.TYPE.SEND) { if (!paymentMethod) { return; diff --git a/src/languages/en.ts b/src/languages/en.ts index 8f772f1260bb..3221b4e64326 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -595,6 +595,7 @@ export default { tagSelection: ({tagName}: TagSelectionParams) => `Select a ${tagName} to add additional organization to your money.`, categorySelection: 'Select a category to add additional organization to your money.', error: { + invalidCategoryLength: 'The length of the category chosen exceeds the maximum allowed (255). Please choose a different or shorten the category name first.', invalidAmount: 'Please enter a valid amount before continuing.', invalidSplit: 'Split amounts do not equal total amount', other: 'Unexpected error, please try again later', diff --git a/src/languages/es.ts b/src/languages/es.ts index 3887891299df..b6588fc9306d 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -589,6 +589,7 @@ export default { tagSelection: ({tagName}: TagSelectionParams) => `Seleccione una ${tagName} para organizar mejor tu dinero.`, categorySelection: 'Seleccione una categoría para organizar mejor tu dinero.', error: { + invalidCategoryLength: 'El largo de la categoría escogida excede el máximo permitido (255). Por favor escoge otra categoría o acorta la categoría primero.', invalidAmount: 'Por favor ingresa un monto válido antes de continuar.', invalidSplit: 'La suma de las partes no equivale al monto total', other: 'Error inesperado, por favor inténtalo más tarde', From 10f4332272d3953df8c773177640e7c1dd2743d3 Mon Sep 17 00:00:00 2001 From: Aldo Canepa Date: Mon, 4 Dec 2023 12:44:53 -0800 Subject: [PATCH 2/3] Add Max category length const --- src/CONST.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CONST.ts b/src/CONST.ts index 13b79179f431..b2be0d05d985 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -55,6 +55,9 @@ const CONST = { ALLOWED_RECEIPT_EXTENSIONS: ['jpg', 'jpeg', 'gif', 'png', 'pdf', 'htm', 'html', 'text', 'rtf', 'doc', 'tif', 'tiff', 'msword', 'zip', 'xml', 'message'], }, + // This is limit set on servers, do not update without wider internal discussion + API_TRANSACTION_CATEGORY_MAX_LENGTH: 255, + AUTO_AUTH_STATE: { NOT_STARTED: 'not-started', SIGNING_IN: 'signing-in', From 1243b91222a0b4648fd9373b321384bc68e9049b Mon Sep 17 00:00:00 2001 From: Aldo Canepa Date: Mon, 4 Dec 2023 16:26:43 -0800 Subject: [PATCH 3/3] Add useCallback dependency --- src/components/MoneyRequestConfirmationList.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 7fb618cdf0eb..34c4e7100e9a 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -486,6 +486,7 @@ function MoneyRequestConfirmationList(props) { props.isEditingSplitBill, props.iouType, props.isDistanceRequest, + props.iouCategory, isDistanceRequestWithoutRoute, props.iouCurrencyCode, props.iouAmount,