-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Don't show RBR for modified date/amount violation if not a policy report #48236
Don't show RBR for modified date/amount violation if not a policy report #48236
Conversation
@@ -5819,7 +5819,7 @@ function doesTransactionThreadHaveViolations( | |||
return ( | |||
TransactionUtils.hasViolation(IOUTransactionID, transactionViolations) || | |||
TransactionUtils.hasWarningTypeViolation(IOUTransactionID, transactionViolations) || | |||
TransactionUtils.hasModifiedAmountOrDateViolation(IOUTransactionID, transactionViolations) | |||
(isPaidGroupPolicy(report) && TransactionUtils.hasModifiedAmountOrDateViolation(IOUTransactionID, transactionViolations)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation of #48147:
When we edit the amount to be higher, we don't receive the modifiedAmount
violation from the BE, but if we edit the date, then we receive the modifiedDate
violation from the BE. We can say that it's a BE issue, but our real issue here is that we have inconsistent conditions.
From what I found, we don't want to show the notice violation (modified date/amount is a type of notice) if it's not a policy report.
const {getViolationsForField} = useViolations(transactionViolations ?? [], isReceiptBeingScanned || !ReportUtils.isPaidGroupPolicy(report)); |
App/src/hooks/useViolations.ts
Lines 59 to 67 in b9af3d1
function useViolations(violations: TransactionViolation[], shouldShowOnlyViolations: boolean) { | |
const violationsByField = useMemo((): ViolationsMap => { | |
const filteredViolations = violations.filter((violation) => { | |
if (excludedViolationsName.includes(violation.name)) { | |
return false; | |
} | |
if (shouldShowOnlyViolations) { | |
return violation.type === CONST.VIOLATION_TYPES.VIOLATION; | |
} |
App/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx
Line 113 in b9af3d1
const hasNoticeTypeViolations = TransactionUtils.hasNoticeTypeViolation(transaction?.transactionID ?? '-1', transactionViolations) && ReportUtils.isPaidGroupPolicy(iouReport); |
To be honest, the condition to show violation or not is really all over the place and it's really easy to miss it, but I'm gonna make it consistent for what we added for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional video showing the RB still shows for policy report:
web.mp4
Not sure if this PR needs to be followed up. |
@bernhardoj Can you please merge with the latest main? |
Done |
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / Safari48236-web-safari-001.mp4MacOS: Desktop48236-desktop-001.mp4iOS: mWeb Safari48236-mweb-safari-001.mp4Android: Native48236-android-native-001.mp4Android: mWeb Chrome48236-mweb-chrome-001.mp4iOS: Native48236-ios-native-001.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bernhardoj.
@francoisl LGTM and tests well too.
Over to you for review.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Details
When we have a modified date/amount violation, we don't show the error in the report if it's not a policy report, but we show it in LHN. This PR will hide it from LHN.
Fixed Issues
$ #48147
$ #47411
PROPOSAL:
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
io.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
MacOS: Desktop