Skip to content

Commit c636f61

Browse files
authored
Merge pull request #52994 from bernhardoj/fix/52243-rbr-not-shown-correctly
Fix RBR is not shown correctly
2 parents d7ee957 + e9f5d0a commit c636f61

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ function MoneyRequestPreviewContent({
117117
const isPartialHold = isSettlementOrApprovalPartial && isOnHold;
118118
const hasViolations = TransactionUtils.hasViolation(transaction?.transactionID ?? '-1', transactionViolations, true);
119119
const hasNoticeTypeViolations = TransactionUtils.hasNoticeTypeViolation(transaction?.transactionID ?? '-1', transactionViolations, true) && ReportUtils.isPaidGroupPolicy(iouReport);
120+
const hasWarningTypeViolations = TransactionUtils.hasWarningTypeViolation(transaction?.transactionID ?? '-1', transactionViolations, true);
120121
const hasFieldErrors = TransactionUtils.hasMissingSmartscanFields(transaction);
121122
const isDistanceRequest = TransactionUtils.isDistanceRequest(transaction);
122123
const isFetchingWaypointsFromServer = TransactionUtils.isFetchingWaypointsFromServer(transaction);
@@ -144,9 +145,7 @@ function MoneyRequestPreviewContent({
144145
// When there are no settled transactions in duplicates, show the "Keep this one" button
145146
const shouldShowKeepButton = !!(allDuplicates.length && duplicates.length && allDuplicates.length === duplicates.length);
146147

147-
const hasDuplicates = duplicates.length > 0;
148-
149-
const shouldShowRBR = hasNoticeTypeViolations || hasViolations || hasFieldErrors || (!isFullySettled && !isFullyApproved && isOnHold) || hasDuplicates;
148+
const shouldShowRBR = hasNoticeTypeViolations || hasWarningTypeViolations || hasViolations || hasFieldErrors || (!isFullySettled && !isFullyApproved && isOnHold);
150149
const showCashOrCard = isCardTransaction ? translate('iou.card') : translate('iou.cash');
151150
// We don't use isOnHold because it's true for duplicated transaction too and we only want to show hold message if the transaction is truly on hold
152151
const shouldShowHoldMessage = !(isSettled && !isSettlementOrApprovalPartial) && !!transaction?.comment?.hold;

src/libs/TransactionUtils/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -884,11 +884,11 @@ function hasNoticeTypeViolation(transactionID: string, transactionViolations: On
884884
/**
885885
* Checks if any violations for the provided transaction are of type 'warning'
886886
*/
887-
function hasWarningTypeViolation(transactionID: string, transactionViolations: OnyxCollection<TransactionViolation[]>, showInReview?: boolean | null): boolean {
887+
function hasWarningTypeViolation(transactionID: string, transactionViolations: OnyxCollection<TransactionViolation[]>, showInReview?: boolean): boolean {
888888
const violations = transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID];
889889
const warningTypeViolations =
890890
violations?.filter(
891-
(violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.WARNING && (showInReview === null || showInReview === (violation.showInReview ?? false)),
891+
(violation: TransactionViolation) => violation.type === CONST.VIOLATION_TYPES.WARNING && (showInReview === undefined || showInReview === (violation.showInReview ?? false)),
892892
) ?? [];
893893

894894
const hasOnlyDupeDetectionViolation = warningTypeViolations?.every((violation: TransactionViolation) => violation.name === CONST.VIOLATIONS.DUPLICATED_TRANSACTION);

0 commit comments

Comments
 (0)