fix: Handle distance unit update when sharing#54048
fix: Handle distance unit update when sharing#54048neil-marcellini merged 6 commits intoExpensify:mainfrom
Conversation
|
@Pujan92 we probably should hold this one because the original PR was reverted 😿 |
|
Oh yes, I just got to know about the revert. |
# Conflicts: # src/libs/actions/IOU.ts
|
@paultsimura Is this ready for review now? |
I'll merge |
# Conflicts: # tests/unit/TransactionUtilsTest.ts
|
Ready for review @Pujan92 |
|
Bump for review @Pujan92 |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2025-02-05.at.14.16.39.movMacOS: Desktop |
MariaHCD
left a comment
There was a problem hiding this comment.
Looks good overall, @neil-marcellini do you want to give this a review since it is a follow up to #51517 (review)?
| * Calculates tax amount from the given expense amount and tax percentage | ||
| */ | ||
| function calculateTaxAmount(percentage: string, amount: number, currency: string) { | ||
| function calculateTaxAmount(percentage: string | undefined, amount: number, currency: string) { |
There was a problem hiding this comment.
Why is percentage optional?
There was a problem hiding this comment.
This is a byproduct of the Lint fix. We used to pass an empty string before:
App/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx
Lines 90 to 91 in 5d3622d
To make it more clear, I've changed '' to undefined, and therefore had to make the percentage param string | undefined.
If you prefer, I can revert the param change and try to modify the logic where I'm calling this function instead.
There was a problem hiding this comment.
Ah, thanks for clarifying. Yeah, I think it's a bit strange to call calculateTaxAmount with no percentage. It would be good to modify the place where the function is called but it's beyond the scope of this PR so I think it's fine as it is.
neil-marcellini
left a comment
There was a problem hiding this comment.
Overall looks good, but I have one question.
src/libs/actions/IOU.ts
Outdated
| comment: { | ||
| customUnit: { | ||
| customUnitRateID, | ||
| defaultP2PRate: null, |
There was a problem hiding this comment.
We should only clear this if there's a policy right?
There was a problem hiding this comment.
I've checked the code - this function is called in only 1 place - when a user manually changes the distance rate:
App/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx
Lines 96 to 102 in ad708d7
This action is not accessible for non-policy requests, as we use only default P2P rate for 1:1 requests.
But I will add a policy-only condition here.
neil-marcellini
left a comment
There was a problem hiding this comment.
Great thanks. Yeah even though it's not a problem in the current flow it's always good to have the check so someone doesn't add a call and accidentally create a bug.
|
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.0.96-0 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.0.96-1 🚀
|
Explanation of Change
Fix the case when the workspace distance unit differs from the tracked expense's when sharing from Self DM.
Fixed Issues
$ #53988
PROPOSAL: #53988 (comment)
Tests
Same as QA
Offline tests
Same as QA
QA Steps
Precondition:
Test:
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(theme.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.webm
Android: mWeb Chrome
chrome.webm
iOS: Native
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-12-12.at.18.17.50.mp4
iOS: mWeb Safari
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-12-12.at.18.16.29.mp4
MacOS: Chrome / Safari
Screen.Recording.2024-12-12.at.18.02.32.mov
MacOS: Desktop
Screen.Recording.2024-12-12.at.18.08.22.mov