-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[Duplicate Expenses] Add Distance Expense Support #77758
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
base: main
Are you sure you want to change the base?
[Duplicate Expenses] Add Distance Expense Support #77758
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
|
Updated flow with modal: desktop-chrome-2026-01-08_15.59.47.mp4 |
|
@hoangzinh 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] |
|
Waiting for translation confirmation, but otherwise I think it's ready! |
joekaufmanexpensify
left a comment
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.
Whats next project 👍
|
@JS00001 Would you be able to run the |
|
Done |
🦜 Polyglot Parrot! 🦜Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues: The diff is too large to include in this comment (282KB), so I've created a gist for you: 📋 View the translation diff here 📋 Note You can apply these changes to your branch by copying the patch to your clipboard, then running |
|
Please let us know when this one's ready! It'd be great if we could try and prioritize this review to get this in tomorrow before you're OOO |
|
@JS00001 It's ready! |
| const duplicateTransaction = useCallback( | ||
| (transactions: Transaction[]) => { | ||
| if (!transactions.length) { | ||
| if (!transactions.length || !policy?.id) { |
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.
It will cause a bug when duplicating an unreported expense; it does nothing
Screen.Recording.2026-01-09.at.17.18.51.mov
| /** | ||
| * Check if there is a custom unit out of policy violation in transactionViolations. | ||
| */ | ||
| function hasCustomUnitOutOfPolicyViolation(transactionViolations?: TransactionViolations | null): boolean { |
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.
NAB: it should be great if we can add unit tests for this util
| existingTransaction: { | ||
| ...(params.transactionParams ?? {}), | ||
| comment: transaction.comment, | ||
| iouRequestType: CONST.IOU.REQUEST_TYPE.DISTANCE, | ||
| modifiedCreated: '', | ||
| reportID: '1', | ||
| transactionID: '1', | ||
| }, |
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.
| existingTransaction: { | |
| ...(params.transactionParams ?? {}), | |
| comment: transaction.comment, | |
| iouRequestType: CONST.IOU.REQUEST_TYPE.DISTANCE, | |
| modifiedCreated: '', | |
| reportID: '1', | |
| transactionID: '1', | |
| }, | |
| existingTransaction: transaction, |
Shouldn't it be transaction?
|
Bug: Duplicate manual distance expense incorrectly creates a cash expense Screen.Recording.2026-01-09.at.17.37.55.mov |
|
Bug: Duplicating a map distance expense creates a distance expense with a different amount/distance Screen.Recording.2026-01-09.at.17.46.111.mov |
|
Bug: [Offline] Duplicating a map distance expense creates a distance expense with an empty submitter and report name Screen.Recording.2026-01-09.at.18.03.47.mov |
|
Sorry, heading OOO now so I'll have to handle these bugs when I'm back on the 16th. |
|
Welcome back, @jjcoffee. Can you fix the conflicts and resume this one? |
Explanation of Change
Adds support for distance expenses, with an additional BE fix for the case that was previously failing on the original PR - duplicating a distance expense from a non-default workspace. Previously this would return an error from the BE and the expense would not get added. Now we do add the expense and display an error about the rate being unavailable.
Fixed Issues
$ #77706
PROPOSAL: N/A
Tests
Same as QA steps.
Offline tests
Same as QA steps.
QA Steps
Prerequisites:
More -> DuplicateRate not valid for this workspaceerror shows upMore -> Duplicate.Fix the distance rate error and try again.Rateand correct the violation by selecting any rate.More -> Duplicateand verify that no modal shows and the expense duplicates.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)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-app-2026-01-06_17.05.29.mp4
Android: mWeb Chrome
android-chrome-2026-01-06_17.08.41.mp4
iOS: Native
ios-app-2026-01-06_16.58.18.mp4
iOS: mWeb Safari
ios-safari-2026-01-06_17.01.08.mp4
MacOS: Chrome / Safari
desktop-chrome-2026-01-07_15.41.08.mp4