[No QA] [Direct Feeds] Broken connection violation#50793
[No QA] [Direct Feeds] Broken connection violation#50793mountiny merged 8 commits intoExpensify:mainfrom
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] |
allgandalf
left a comment
There was a problem hiding this comment.
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.
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.
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.
What about the case when the submitter itself is the policy admin ?
There was a problem hiding this comment.
The logic for the admin will be applied. Do you have any concerns?
There was a problem hiding this comment.
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.
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.
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.
I'll update the check in ~15 mins!
There was a problem hiding this comment.
@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.
Updated! Thank you all for clarifications! ✨
|
|
||
| /** Banner Description */ | ||
| description: string; | ||
| description: string | ReactElement; |
There was a problem hiding this comment.
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.
@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
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 |
allgandalf
left a comment
There was a problem hiding this comment.
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 !
| } | ||
| 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.
When will we use these translations? Should we remove then?
There was a problem hiding this comment.
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.
They can also be the submitter if they are admin
There was a problem hiding this comment.
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 🚀
|
| rter: ({brokenBankConnection, email, isAdmin, isTransactionOlderThan7Days, member}: ViolationsRterParams) => { | ||
| 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 ''; |
There was a problem hiding this comment.
This caused issue
we should show violation message for the two type of violations.








Details
[Direct Feeds] Broken connection violation
Fixed Issues
$ #50454
PROPOSAL: N/A
Tests
transactionId.brokenCardConnectionviolation to transaction violations. Example:Also, you can pass it in
successDataforOpenReportcall, this way it won't be overwritten.Offline tests
Same as in the
Testssection.QA Steps
N/A
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop