diff --git a/src/CONST.ts b/src/CONST.ts index 6f1fe37f661d..82418e893fe7 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', diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index 258a15c4c813..1bd7b71c5aa3 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; @@ -483,6 +486,7 @@ function MoneyRequestConfirmationList(props) { props.isEditingSplitBill, props.iouType, props.isDistanceRequest, + props.iouCategory, isDistanceRequestWithoutRoute, props.iouCurrencyCode, props.iouAmount, diff --git a/src/languages/en.ts b/src/languages/en.ts index c3f663eee4e0..bd2d941a7057 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -597,6 +597,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 b4e0e37d0614..5c80ec93ac75 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -591,6 +591,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',