Skip to content

Commit

Permalink
Merge pull request #30240 from esh-g/trunacte-request-description
Browse files Browse the repository at this point in the history
Truncated money request preview
  • Loading branch information
Joel Bettner authored Jan 4, 2024
2 parents 7da5757 + deee05c commit 0b74586
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ const CONST = {

MERCHANT_NAME_MAX_LENGTH: 255,

REQUEST_PREVIEW: {
MAX_LENGTH: 83,
},

CALENDAR_PICKER: {
// Numbers were arbitrarily picked.
MIN_YEAR: CURRENT_YEAR - 100,
Expand Down
6 changes: 4 additions & 2 deletions src/components/ReportActionItem/MoneyRequestPreview.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {truncate} from 'lodash';
import lodashGet from 'lodash/get';
import PropTypes from 'prop-types';
import React from 'react';
Expand Down Expand Up @@ -151,8 +152,9 @@ function MoneyRequestPreview(props) {
// Pay button should only be visible to the manager of the report.
const isCurrentUserManager = managerID === sessionAccountID;

const {amount: requestAmount, currency: requestCurrency, comment: requestComment, merchant: requestMerchant} = ReportUtils.getTransactionDetails(props.transaction);
const description = requestComment;
const {amount: requestAmount, currency: requestCurrency, comment: requestComment, merchant} = ReportUtils.getTransactionDetails(props.transaction);
const description = truncate(requestComment, {length: CONST.REQUEST_PREVIEW.MAX_LENGTH});
const requestMerchant = truncate(merchant, {length: CONST.REQUEST_PREVIEW.MAX_LENGTH});
const hasReceipt = TransactionUtils.hasReceipt(props.transaction);
const isScanning = hasReceipt && TransactionUtils.isReceiptBeingScanned(props.transaction);
const hasFieldErrors = TransactionUtils.hasMissingSmartscanFields(props.transaction);
Expand Down

0 comments on commit 0b74586

Please sign in to comment.