Fix - 1:1 Submit expense - The receiving end of the IOU should not be asked to fill out information if the scan failed #53947
Conversation
|
Bump for a review @getusha |
Reviewer Checklist
Screenshots/VideosAndroid: mWeb ChromeScreen.Recording.2024-12-18.at.6.32.53.in.the.evening.mov |
|
@FitseTLT noticed a RBR on the report preview. it disappears when you click on it. 1217.mov |
|
@FitseTLT could you please add a unit test? thanks |
Added |
|
@FitseTLT we've got conflicts |
|
@FitseTLT can you please fix the conflicts? Thanks! |
|
|
|
Apart from the lint and ts errors coming from main I have fixed all the current pr errors. @getusha |
|
@VickyStash @mountiny @getusha I am having confusing unrelated lint/ts errors on files that I haven't changed. Do you have any idea? |
As I see not the Changed files ESLint check failed for you, but the usual ESLint check/TypeScript Checks. These checks are expected to fail even in the files you didn't change in case of broken typing. In this case it looks dut to updates in ROUTES.ts file the Route type became too complex union and TS can't process it. cc @fabioh8010 |
|
@VickyStash @mountiny @FitseTLT This is a problem we faced in the past with the |
Thx so I think the next step would be to wait for the PR to be merged @fabioh8010, right? |
|
👍 |
|
@FitseTLT The PR was merged, can you please sync with main? |
|
Conflict resolved @mountiny The only doubt I want you to confirm is whether it is correct to apply the pattern we applied here of hiding violations for the non-editable side for all violations like warning and notice type violations. |
mountiny
left a comment
There was a problem hiding this comment.
I am really worried about this many changes 😅 also this might have performance impact if we deciding if to show the RBR in LHN using the new canEditTransaction method
| * because there is no point of showing RBR for the user who cannot edit the request. | ||
| */ | ||
| function shouldShowMissingSmartscanFieldsError(transaction: OnyxInputOrEntry<Transaction>, parentReportAction?: OnyxEntry<ReportAction>): boolean { | ||
| if (!canEditTransaction(transaction?.transactionID ?? '-1', parentReportAction)) { |
There was a problem hiding this comment.
should there be default here with the new rules?
There was a problem hiding this comment.
What do you mean ?
| * true because we use this function to show RBR only for the user side who can edit the transaction | ||
| * but if we can't determine they cannot edit it, we opted to show the RBR instead of hiding it. | ||
| */ | ||
| function canEditTransaction(transactionID: string | undefined, parentReportAction: OnyxEntry<ReportAction>): boolean { |
There was a problem hiding this comment.
This seems like very heavy function. How often will it be called?
There was a problem hiding this comment.
For every transaction on which we are checking the existence of violation
There was a problem hiding this comment.
@mountiny really good catch. From what I can see here this can really become a bottleneck for cases like David's. Here's what I'd do:
- wait for these changes to get merged (we can't really open up big accounts without this in a diff),
- checkout to this PR and load David's Onyx state (attached in the Slack thread) locally (before & after), profile regular workflows and submitting expenses to get a Hermes trace,
- assess the impact then and decide on the next steps
|
@FitseTLT Sorry, this change is really substantial so I am discussing with Tom the exact expecte behaviour now that we know the changes you have implemented so far. I am still worried about the performance - consider that this additional method is called whenever the LHN is rerendered / computed and that happens often. For accounts that have hundreds if not thousands of transactions locally this could have material impact |
|
@FitseTLT sorry for the confusion here, but I think we are going to have to move in a bit different direction here.
Because of that, let's take a step back and simply take the similar solution you originally proposed, let's update the copy of the error for the person who cannot edit it to say something like: |
|
Ok great @mountiny I had hated the inconsistency in the first place. I will close this PR and open a new one 👍 |





Details
Fixed Issues
$ #51574
PROPOSAL: #51574 (comment)
Tests
Start the Submit expense flow in a 1:1 conversation with a user you have access to
Select the scan option
Upload a picture that will fail the scan process
Wait for the scan to fail
Log in as the other account
Navigate to the IOU that failed the scan
Verify the receiver is not asked to fill out the missing information no RBR is shown
On a workspace set tag as required field and allow approval workflow as the admin as the approver
From an employee side of the workspace create an expense without setting tag field
From an employee side verify that RBR is shown and tag required violation text is shown but no RBR shown from the admin side (b/c the admin cannot edit the request)
Now from the admin side approve the expense
Verify that now the employee (now can't edit the expense) will not see the RBR and violation but the admin can see the RBR
Offline tests
Same as above
QA Steps
Same as above
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so 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