Repository navigation
feat: add require company cards toggle to rules revamp - #100241
Conversation
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
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.
|
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
|
🚧 JmillsExpensify has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
| // upgrade the other rules use, and drops the More features tooltip, which isn't why the row is locked there. | ||
| const requireCompanyCardsEnabled = policy?.requireCompanyCardsEnabled ?? false; | ||
| const areAnyCardsEnabled = !!policy?.areCompanyCardsEnabled || !!policy?.areExpensifyCardsEnabled; | ||
| const isRequireCompanyCardsLocked = !canWriteRules || isCollect || !areAnyCardsEnabled; |
There was a problem hiding this comment.
is the isCollect true? Do we need to change this based on the rules beta? (where rules are enabled for more than just control plans?
There was a problem hiding this comment.
More of a product question.
This is already consistent with other switches
Screen.Recording.2026-09-03.at.4.22.34.PM.mov
There was a problem hiding this comment.
isCollect is only reachable because of the revamp beta, canPolicyAccessFeature gates Rules to Control unless it's on. Pre-revamp Collect couldn't open the Rules page, so no Collect workspace has this on today and the lock costs nothing. Same treatment as eReceipts and attendee tracking.
cc: @JmillsExpensify
There was a problem hiding this comment.
Agreed. Let's lock this on Collect and make it an upgrade path.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb SafariMacOS: Chrome / Safariweb.mov |
|
Bug: Wrong tooltip for permission-locked rows
Screen.Recording.2026-09-03.at.4.13.06.PM.mov |
|
Bug: there's no RBR on failed row while 🔴 appears in workspaces tab
This also happens on other rows (i.e. eReceipts switch) so not blocker. Happening on production Screen.Recording.2026-09-03.at.4.16.26.PM.mov |
| const styles = useThemeStyles(); | ||
| const policy = usePolicy(policyID); | ||
| // Only for the read-only modal a locked row still owes a member. `canWrite` is the `canWriteRules` prop already. | ||
| const {withReadOnlyFallback} = usePolicyFeatureWriteAccess(policy, CONST.POLICY.POLICY_FEATURE.RULES); |
There was a problem hiding this comment.
Why is this hook needed?
Is this switch toggle different from other rows regarding permission?
i.e.
eReceipts used this condition: disabledAction={isCollect && canWriteRules ? navigateToRulesControlUpgrade : undefined}
There was a problem hiding this comment.
You're right that the row shouldn't be special, but the inconsistency ran the other way. Pre-revamp, all four toggles used withReadOnlyFallback(), and PublicReceiptVisibilityToggle took it as a prop. Splitting this section out dropped it from the other three, so read-only members got a lock with no explanation. I restored it on all four, they're consistent now.
situchan
left a comment
There was a problem hiding this comment.
Let's just make this PR simple to be consistent with other similar rows (eReceipts, Attendee tracking)
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
"Company card purchases required" violation shows even when both Company cards, Expensify cards are not enabled. bug.mov |
|
🤖 Web test steps verification results: Heads up on the coverage before the results: the test account doesn't have the
Code reviewThe diff reads correctly. Splitting the three lock reasons apart is the right call, and gating 1. A failed toggle leaves a red dot nobody can clear. This is errors={policy?.errorFields?.requireCompanyCardsEnabled}
onCloseError={() => clearPolicyErrorField(policyID, 'requireCompanyCardsEnabled')}Agreed it's pre-existing on the other rows, so fixing those too is optional — but the row this PR introduces shouldn't ship with the gap. 2. The second |
|
🤖 Web test steps verification results: ✅ pass All four revamped Rules > General toggle rows render correctly on a Control workspace and toggle on/off without error; on a Collect workspace the same rows show locked and tapping either the locked eReceipts or locked Require-company-cards row opens the Control Upgrade page, not a read-only modal. I force-enabled the
RegressionsOne behavior regression in the diff, and it lands on the three rows you changed rather than the new one. I didn't reproduce it at runtime (I'd need an archived workspace), so it's read from the code. Archived workspaces now tell an admin their role is the problem. Everything else I checked came back clean:
Still open from my last pass: a failed toggle writes |
|
🚧 JS00001 has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/JS00001 in version: 9.4.73-0 🚀
|
|
Yes — help site changes are required, and I've opened them: #100490 The toggle you restored is already documented in I confirmed it in the app: on a brand-new Control workspace with zero card feeds, the toggle was present, unlocked, and switched on with no error. What changed in the docs PRThree corrections, all in
Every label I used was read off the live app: More features, Company cards, Expensify Card, Rules, and the toggle title and subtitle. The article's existing "Company card purchases required" violation name already matches Deliberately not documented: the revamped Rules page is still behind the @Krishna2323, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.4.73-3 🚀
Bundle Size Analysis (Sentry): |



















Explanation of Change
Fixed Issues
$ #100218
PROPOSAL:
Tests
Collect workspace (upgrade path)
Control workspace with no card product
Read-only access
Offline tests
QA Steps
Same as tests
Verify that no errors appear in the JS console
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: mWeb Chrome
iOS: Native
ios_hybrid.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
web_chrome.mp4