Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show error for tag when create expense #57370

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ const CONST = {
// This is limit set on servers, do not update without wider internal discussion
API_TRANSACTION_CATEGORY_MAX_LENGTH: 255,

API_TRANSACTION_TAG_MAX_LENGTH: 255,

AUTO_AUTH_STATE: {
NOT_STARTED: 'not-started',
SIGNING_IN: 'signing-in',
Expand Down
5 changes: 5 additions & 0 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,11 @@ function MoneyRequestConfirmationList({
return;
}

if (getTag(transaction).length > CONST.API_TRANSACTION_TAG_MAX_LENGTH) {
setFormError('iou.error.invalidTagLength');
return;
}

if (isPerDiemRequest && (transaction.comment?.customUnit?.subRates ?? []).length === 0) {
setFormError('iou.error.invalidSubrateLength');
return;
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,7 @@ const translations = {
categorySelection: 'Select a category to better organize your spend.',
error: {
invalidCategoryLength: 'The category name exceeds 255 characters. Please shorten it or choose a different category.',
invalidTagLength: 'The tag name exceeds 255 characters. Please shorten it or choose a different tag.',
invalidAmount: 'Please enter a valid amount before continuing.',
invalidIntegerAmount: 'Please enter a whole dollar amount before continuing.',
invalidTaxAmount: ({amount}: RequestAmountParams) => `Maximum tax amount is ${amount}`,
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,7 @@ const translations = {
categorySelection: 'Selecciona una categoría para organizar mejor tus gastos.',
error: {
invalidCategoryLength: 'La longitud de la categoría escogida excede el máximo permitido (255). Por favor, escoge otra categoría o acorta la categoría primero.',
invalidTagLength: 'El nombre de la etiqueta supera los 255 caracteres. Por favor, acórtalo o elige una etiqueta diferente.',
invalidAmount: 'Por favor, ingresa un importe válido antes de continuar.',
invalidIntegerAmount: 'Por favor, introduce una cantidad entera en dólares antes de continuar.',
invalidTaxAmount: ({amount}: RequestAmountParams) => `El importe máximo del impuesto es ${amount}`,
Expand Down