Show rate out-of-policy violation for disabled Track distance rates - #100549
Show rate out-of-policy violation for disabled Track distance rates#100549neerajbachani wants to merge 3 commits into
Conversation
Track distance expenses should surface the same custom unit rate violation as submit expenses on expense details, inbox previews, and Spend when a workspace rate is disabled.
Correct Policy type import in DistanceRate, fix TransactionListItem formatting, stub syncCustomUnitOutOfPolicyViolation in hook tests, and use customUnit for violation recompute typing.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54d018e913
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…lation Leave customUnitOutOfPolicy untouched when the workspace rate cannot be resolved, add regression tests for deleted rates and FAKE_P2P_ID on policy chats, and fix comment style nits.
|
Addressed review feedback in a9b3359 |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9b3359642
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ]; | ||
| } | ||
|
|
||
| return hasViolation ? violations.filter((violation) => violation.name !== CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY) : violations; |
There was a problem hiding this comment.
Preserve violations for rates owned by another workspace
When an expense belongs to workspace B but retains a rate ID owned by workspace A, the new callers resolve distanceOriginalPolicy; this branch then removes customUnitOutOfPolicy merely because that source-workspace rate is enabled. This hides the existing invalid-rate warning even though the rate is still absent from the expense report’s policy—for example, after moving an expense when the destination has no eligible replacement rate. Only clear the violation when the rate belongs to the report policy or the expense is confirmed to be a personal/self-DM expense.
Useful? React with 👍 / 👎.
Track distance expenses should surface the same custom unit rate violation as submit expenses on expense details, inbox previews, and Spend when a workspace rate is disabled.
Explanation of Change
When a workspace distance rate is disabled, submit expenses already show a Rate not valid violation on expense details, Inbox, and Spend. Track distance expenses did not, because:
MoneyRequestViewsuppressedcustomUnitOutOfPolicyfor Track expenses.This PR mirrors the existing category/tag/tax violation path:
customUnitOutOfPolicyto Onyx when disabling/re-enabling rates viasetPolicyDistanceRatesEnabled.syncCustomUnitOutOfPolicyViolationfor Inbox previews and Spend rows.Fixed Issues
$ #93414
PROPOSAL: #93414 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.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