Skip to content

Commit

Permalink
Merge pull request Expensify#36252 from infinitered/violations/cdanwa…
Browse files Browse the repository at this point in the history
…rds/merchant-required
  • Loading branch information
cead22 authored Feb 15, 2024
2 parents 2fe384c + fda1f51 commit f4d1b5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
interactive={!isReadOnly}
brickRoadIndicator={merchantError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''}
error={merchantError ? translate('common.error.fieldRequired') : ''}
rightLabel={isMerchantRequired ? translate('common.required') : ''}
/>
),
shouldShow: shouldShowMerchant,
Expand Down
10 changes: 5 additions & 5 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,8 @@ function buildOnyxDataForMoneyRequest(
},
];

// Policy won't be set for P2P cases for which we don't need to compute violations
if (!policy?.id) {
// We don't need to compute violations unless we're on a paid policy
if (!policy || !PolicyUtils.isPaidGroupPolicy(policy)) {
return [optimisticData, successData, failureData];
}

Expand Down Expand Up @@ -1224,7 +1224,7 @@ function getUpdateMoneyRequestParams(
});
}

if (policy?.id && updatedTransaction) {
if (policy && PolicyUtils.isPaidGroupPolicy(policy) && updatedTransaction) {
const currentTransactionViolations = allTransactionViolations[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`] ?? [];
optimisticData.push(
ViolationsUtils.getViolationsOnyxData(
Expand Down Expand Up @@ -2670,8 +2670,8 @@ function editRegularMoneyRequest(
},
];

// Add transaction violations if there is a policy and updated transaaction
if (policy?.id && updatedTransaction) {
// Add transaction violations if we have a paid policy and an updated transaction
if (policy && PolicyUtils.isPaidGroupPolicy(policy) && updatedTransaction) {
const currentTransactionViolations = allTransactionViolations[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`] ?? [];
const updatedViolationsOnyxData = ViolationsUtils.getViolationsOnyxData(
updatedTransaction,
Expand Down

0 comments on commit f4d1b5a

Please sign in to comment.