[Workspace Roles] Lock approval toggle from backend signal instead of card data - #94518
Draft
ShridharGoel wants to merge 3 commits into
Draft
[Workspace Roles] Lock approval toggle from backend signal instead of card data#94518ShridharGoel wants to merge 3 commits into
ShridharGoel wants to merge 3 commits into
Conversation
The Workflows page derived the approval-toggle lock (isSmartLimitEnabled) from the workspace Expensify Card list, which required shipping card data to roles without Expensify Card access. Consume the backend areApprovalsLockedByExpensifyCard boolean instead, falling back to the card-list derivation for older payloads. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Auth deploys before App, so policy.areApprovalsLockedByExpensifyCard is always present. Consume it directly and remove the now-dead Expensify Card reads (useCardFeeds, workspace cards list) the Workflows page used for the old client-side derivation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
flodnv
requested changes
Jul 1, 2026
| const isSmartLimitEnabled = isSmartLimitEnabledUtil(workspaceCards); | ||
| // The backend sends areApprovalsLockedByExpensifyCard so the approval toggle can lock without the page | ||
| // loading any Expensify Card data. | ||
| const isSmartLimitEnabled = policy?.areApprovalsLockedByExpensifyCard ?? false; |
Contributor
There was a problem hiding this comment.
Why is this in the Policy in Onyx? This isn't actually stored in the Policy in the DB, so I don't think it should be on the Policy object in Onyx.
Backend returns policyApprovalsLockedByExpensifyCard_<policyID> as a separate onyx entry, so read it via useOnyx and drop the field from the Policy type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
The Workspace Workflows page locks the "Add approvals" toggle while the workspace uses Smart Limit Expensify Cards. It derived that lock client-side from the workspace's Expensify Card list (
isSmartLimitEnabled), which forced the backend to ship Expensify Card data to everyone who can open the page — including roles that can edit approvals but cannot read the Expensify Card feature (e.g. People admins). That exposed card data they should not see.The backend now sends a single boolean,
policy.areApprovalsLockedByExpensifyCard, and stops shipping card data to roles without Expensify Card read access (see the Auth PR). This PR consumes that boolean to lock the approval toggle and removes the Expensify Card reads the page previously used to derive the lock client-side. The Auth PR deploys first, so the boolean is always present by the time this ships.Auth counterpart: https://github.com/Expensify/Auth/pull/22489
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/644795
PROPOSAL:
Tests
Offline tests
policy.areApprovalsLockedByExpensifyCard).QA Steps
Same as Tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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