-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[No QA] [Direct Feeds] Broken connection violation #50793
[No QA] [Direct Feeds] Broken connection violation #50793
Conversation
@allgandalf Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
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.
seems good to me, other then the type of description
, I see this PR matching the design doc, i will complete the checklist in the meantime
function BrokenConnectionDescription({transactionID, policy, report}: BrokenConnectionDescriptionProps) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
const [transactionViolations] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`); |
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.
my concern here is that for a fraction of time useOnyx
gives undefined value, hope this doesn't affect the violation fetch. We can only test this in production, so lets stay hopeful 🤞
return translate('violations.brokenConnection530Error'); | ||
} | ||
|
||
if (isPolicyAdmin) { |
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.
cool makes sense, according to docs:
Admins can also see violation, but we hide the Mark as cash button (same as the 7-day-hold doc.)
So we match the expected results
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.
What about the case when the submitter itself is the policy admin ?
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.
The logic for the admin will be applied. Do you have any concerns?
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.
yes, if i am admin and i submit a request with violation, Now i won't be able to see the mark as cash
button even when i submitted the report, is that expected?
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.
I guess so cause you, as admin, can go to Company Cards page and resolve the violation (fix broken connection).
cc @joekaufmanexpensify @mountiny To confirm as well.
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.
If the admin is a submitter on that report, lets show them the Mark as cash
button too. So I guess the logic would be - show it to the users who is the owner of the report (submitter) even if they are admin
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.
c.c. @VickyStash
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.
I'll update the check in ~15 mins!
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.
@mountiny I've started to have some doubts about this approach as it goes against the docs.
In docs it mentiones that
Admins can’t resolve this violation with the Mark as cash button, but they can fix the broken card connection, which indirectly resolves this violation.
Also the message for the admin doesn't mention Mark as cash button. Should we then update the text of the message for the admin?
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.
Updated! Thank you all for clarifications! ✨
@@ -9,7 +9,7 @@ type MoneyRequestHeaderStatusBarProps = { | |||
icon: ReactNode; | |||
|
|||
/** Banner Description */ | |||
description: string; | |||
description: string | ReactElement; |
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.
Shouldn't we save the description as string itself, we can convert the prop into string before passing ? (saying cause we don't want the BE to throw some weird error
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.
@allgandalf could you clarify what BE errors do you mean?
This component just renders the description display.
Since for the admin, the broken connection violation text can include TextLink (link to company cards), it returned as a component.
App/src/components/MoneyRequestHeaderStatusBar.tsx
Lines 18 to 28 in 91e299d
function MoneyRequestHeaderStatusBar({icon, description, shouldStyleFlexGrow = true}: MoneyRequestHeaderStatusBarProps) { | |
const styles = useThemeStyles(); | |
return ( | |
<View style={[styles.dFlex, styles.flexRow, styles.alignItemsCenter, shouldStyleFlexGrow && styles.flexGrow1, styles.overflowHidden, styles.headerStatusBarContainer]}> | |
<View style={styles.mr2}>{icon}</View> | |
<View style={[styles.flexShrink1]}> | |
<Text style={[styles.textLabelSupporting]}>{description}</Text> | |
</View> | |
</View> | |
); | |
} |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-10-16.at.6.08.19.PM.movMacOS: DesktopScreen.Recording.2024-10-16.at.3.02.43.PM.mov |
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.
functionality and styling are correct and match the design doc, we only made one change that if admin is submitter then we show the mark as cash
button (details in slack).
Looks great to me, thanks for the quick work !
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.
Small nab comments
rter: ({brokenBankConnection, email, isAdmin, isTransactionOlderThan7Days, member, rterType}: ViolationsRterParams) => { | ||
if (rterType === CONST.RTER_VIOLATION_TYPES.BROKEN_CARD_CONNECTION_530 || rterType === CONST.RTER_VIOLATION_TYPES.BROKEN_CARD_CONNECTION) { | ||
return ''; | ||
} | ||
if (brokenBankConnection) { | ||
return isAdmin | ||
? `Can't auto-match receipt due to broken bank connection which ${email} needs to fix` |
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.
When will we use these translations? Should we remove then?
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.
The updates were implemented in this PR.
It looks like it makes the error to be shown next to the merchant field on the Money Request View for rter violation.
function shouldShowBrokenConnectionViolation(transactionID: string, report: OnyxEntry<Report>, policy: OnyxEntry<Policy>): boolean { | ||
return ( | ||
hasBrokenConnectionViolation(transactionID) && | ||
(!PolicyUtils.isPolicyAdmin(policy) || ReportUtils.isOpenExpenseReport(report) || (ReportUtils.isProcessingReport(report) && PolicyUtils.isInstantSubmitEnabled(policy))) |
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.
They can also be the submitter if they are admin
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.
You mean I should update it to:
const isUserMemberOrSubmitter = !PolicyUtils.isPolicyAdmin(policy) || ReportUtils.isCurrentUserSubmitter(report.reportID);
return (
hasBrokenConnectionViolation(transactionID) &&
(isUserMemberOrSubmitter || ReportUtils.isOpenExpenseReport(report) || (ReportUtils.isProcessingReport(report) && PolicyUtils.isInstantSubmitEnabled(policy)))
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.51-1 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.51-4 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.51-4 🚀
|
Details
[Direct Feeds] Broken connection violation
Fixed Issues
$ #50454
PROPOSAL: N/A
Tests
transactionId
.brokenCardConnection
violation to transaction violations. Example:Also, you can pass it in
successData
forOpenReport
call, this way it won't be overwritten.Offline tests
Same as in the
Tests
section.QA Steps
N/A
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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop