Repository navigation
[Payment due @Ollyws] Remove isPolicyExpenseChatEnabled from PolicyUtils.ts helpers - #93588
puneetlath merged 10 commits into
Conversation
This is PR A1 of the isPolicyExpenseChatEnabled removal plan. All isPolicyExpenseChatEnabled checks in App are already paired with isPaidGroupPolicy() or equivalent, making the flag redundant. Changes: - getActivePoliciesWithExpenseChat(): Remove isPolicyExpenseChatEnabled from filter, keep other conditions (pendingAction, name, id, role) - canSubmitPerDiemExpenseFromWorkspace(): Remove isPolicyExpenseChatEnabled, keep perDiem checks only - getDefaultChatEnabledPolicy(): Remove isPolicyExpenseChatEnabled, keep isGroupPolicy() check Issue: Expensify/Expensify#370320
This is PR A1 of the isPolicyExpenseChatEnabled removal plan. The isPolicyExpenseChatEnabled flag was always true for paid group policies (TEAM/CORPORATE), making it redundant when used alongside policy type checks. Changes: - getActivePoliciesWithExpenseChat(): Replace isPolicyExpenseChatEnabled with isPaidGroupPolicy() to maintain the same semantic meaning - canSubmitPerDiemExpenseFromWorkspace(): Remove isPolicyExpenseChatEnabled, perDiem checks are sufficient (only Control policies have per diem units) - getDefaultChatEnabledPolicy(): Remove isPolicyExpenseChatEnabled, keep isGroupPolicy() check Issue: Expensify/Expensify#370320
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c0846d8fe8
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Combines PR A1 and A2 changes: - getGroupPaidPoliciesWithExpenseChatEnabled(): Renamed to getGroupPaidPolicies() and removed isPolicyExpenseChatEnabled (isPaidGroupPolicy is sufficient) - getGroupPoliciesWhereReportCanBeCreated(): Removed isPolicyExpenseChatEnabled, kept isPaidGroupPolicy and canAccessSubmitWorkspaceFeatures checks Updated all usages of the renamed function in: - IOURequestStepDistanceRate.tsx - SplitExpenseEditPage.tsx - ProductTrainingContext/index.tsx - SplitExpenses.ts
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Address review feedback: Instead of just checking isGroupPolicy, verify that activePolicy is actually in the groupPoliciesWithChatEnabled list to ensure it passes the same filtering criteria as the callers.
isPolicyExpenseChatEnabled from PolicyUtils.ts helpers
Submit policies don't have isPolicyExpenseChatEnabled=true, so use isPaidGroupPolicy (TEAM/CORPORATE only) instead of isGroupPolicy to maintain the original behavior.
Maintain original isPolicyExpenseChatEnabled behavior by adding isPaidGroupPolicy check alongside the perDiem unit checks.
Extract hasAnyPaidPolicy() helper to simplify boolean checks for whether user has any paid workspaces. Use it in: - SplitExpenseEditPage.tsx - ProductTrainingContext/index.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21474e2c8c
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Address review feedback: the membership check broke the FAB Create report caller, which truncates groupPoliciesWithChatEnabled to 2 entries. Validate the active policy directly via isPaidGroupPolicy instead, which preserves the original isPolicyExpenseChatEnabled semantics (TEAM/CORPORATE only) and avoids the truncated-list edge case.
|
No product review needed |
isPolicyExpenseChatEnabled from PolicyUtils.ts helpersisPolicyExpenseChatEnabled from PolicyUtils.ts helpers
|
@Ollyws how's this going? Is it approved? |
|
@fedirjh you have conflicts. |
|
@puneetlath Just finishing it off now. |
…nseChatEnabled-A1
Ok, let me know when it's ready for me! |
Ollyws
left a comment
There was a problem hiding this comment.
LGTM. @puneetlath all yours.
isPolicyExpenseChatEnabled from PolicyUtils.ts helpersisPolicyExpenseChatEnabled from PolicyUtils.ts helpers
|
🎯 @Ollyws, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
|
@Ollyws the reviewer checklist test is failing. |
|
Hmm weird, it's the latest checklist and all filled out.. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid_Native.mp4Android: mWeb ChromeAndroid_Chrome.moviOS: HybridAppiOS_Native.moviOS: mWeb SafariiOS_Safari.movMacOS: Chrome / SafariMacOS_Chrome_01.movMacOS_Chrome_02.movMacOS_Chrome_03.movMacOS_Chrome_04.mov |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @puneetlath has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 9.4.16-1 🚀
Bundle Size Analysis (Sentry): |
|
🤖 I reviewed the changes in this PR against Expensify's help site files under No help site changes are required. This PR is an internal code refactor that removes the redundant Since there is no user-facing change — no new or renamed features, tabs, settings labels, buttons, or workflows — there is nothing to document or update on the help site. I have not created a draft PR. If a future PR in the |
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.4.16-5 🚀
|
|
🤖 Payment issue created: #94223 |
Explanation of Change
This is PR A1 of the
isPolicyExpenseChatEnabledremoval plan from https://github.com/Expensify/Expensify/issues/370320.All
isPolicyExpenseChatEnabledchecks in App are already paired withisPaidGroupPolicy()or equivalent, making the flag redundant. This PR removes the flag from 3 simple helper functions inPolicyUtils.ts:getActivePoliciesWithExpenseChat()- RemovedisPolicyExpenseChatEnabledfrom filter, keeping other conditions (pendingAction,name,id,getPolicyRole)canSubmitPerDiemExpenseFromWorkspace()- RemovedisPolicyExpenseChatEnabled, keeping perDiem checks onlygetDefaultChatEnabledPolicy()- RemovedisPolicyExpenseChatEnabled, keepingisGroupPolicy()checkFixed Issues
$ Part of https://github.com/Expensify/Expensify/issues/370320
Tests
Prerequisites:
+in email (e.g.,yourname+test1@gmail.com) to mark it as a test accountTest 1: Create an Expense — Choose recipient (Personal / self-DM vs. Workspace)
$25.00) on the Manual tab and tap NextTest 1b: Create Expense — Submit to a workspace
Test 1c: Create Expense — Per Diem recipient filtering
Test 2: Per Diem Expense
Setup: On a Corporate workspace, go to Settings → Workspaces → [workspace] → Per diem, enable Per diem, and add a rate (e.g., "Daily",
$100).Test 2b: Per Diem — no eligible workspace
Test 3: Time Tracking
Setup: On a Corporate workspace, go to Settings → Workspaces → [workspace] → Time and enable Time tracking.
2 hours), add a description, and create the expenseTest 4: Split Expense
$50.00) and select participantsTest 5: Change Expense Workspace
Offline tests
N/A - This PR removes redundant checks; offline behavior is unchanged.
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
N/A - No UI changes
Android: mWeb Chrome
N/A - No UI changes
iOS: Native
N/A - No UI changes
iOS: mWeb Safari
N/A - No UI changes
MacOS: Chrome / Safari
N/A - No UI changes