Skip to content

Commit

Permalink
Addressed to reviewer comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahe Shahinyan committed Mar 5, 2024
1 parent fddaebb commit ec77c7c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ function MoneyRequestPreviewContent({
const violations = TransactionUtils.getTransactionViolations(transaction.transactionID, transactionViolations);
if (violations?.[0]) {
const violationMessage = ViolationsUtils.getViolationTranslation(violations[0], translate);
const isTooLong = violations.filter((v) => v.type === 'violation').length > 1 || violationMessage.length > 15;
const violationsCount = violations.filter((v) => v.type === 'violation').length;
const isTooLong = violationsCount > 1 || violationMessage.length > 15;
const hasViolationAndFieldErrors = violationsCount === 1 && hasFieldErrors;

return `${message}${isTooLong ? translate('violations.reviewRequired') : violationMessage}`;
return `${message}${isTooLong || hasViolationAndFieldErrors ? translate('violations.reviewRequired') : violationMessage}`;
}

const isMerchantMissing = TransactionUtils.isMerchantMissing(transaction);
Expand Down

0 comments on commit ec77c7c

Please sign in to comment.