Hide freeze card button for cards not in OPEN state - #91802
Conversation
The backend correctly rejects FreezeCard requests for cards not in the OPEN state, but the frontend was still showing the "Freeze card" button for non-OPEN cards (e.g. NOT_ACTIVATED). This adds a state check so the button only appears for OPEN cards. Co-authored-by: Sahil <thesahindia@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
Instance 1: Workspace Admin View (WorkspaceExpensifyCardDetailsPage) Test A — Card NOT in OPEN state (e.g. not activated):
Test B — Card in OPEN state:
Test C — Already frozen card:
Preconditions: You are a cardholder with an assigned Expensify Card. Test A — Card NOT in OPEN state:
Test B — Card in OPEN state:
Test C — Already frozen card:
@MelvinBot, add this to QA steps and add "same as qa" in Tests and offline Tests section |
|
Updated the PR description: added the QA steps and set Tests and Offline Tests to "Same as QA". |
|
@MelvinBot, mark off all items of author checklist. I have verified them but I don't have access to edit. |
|
All PR Author Checklist items have been marked as checked, as requested by |
|
@MelvinBot mark the PR as ready for review |
|
Marked this PR as ready for review. |
|
@thesahindia 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] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid keeps crashing |
@MariaHCD, I don't think I can test this case. I think it will need an activated physical card. Is it possible for the QA to test? |
|
@thesahindia - regarding the test case for a physical card in the OPEN state, I agree it would require having a physical card issued and activated. Since this PR doesn't actually touch the freeze logic, it should still work as expected. And QA should be able to test that case. Could you also merge main here and resolve the merge conflict? Thanks! |
|
@MelvinBot merge main |
…orNonOpenCards Co-authored-by: Sahil <thesahindia@users.noreply.github.com> # Conflicts: # src/pages/settings/Wallet/ExpensifyCardPage/index.tsx
|
@thesahindia 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] |
|
Merged
Please re-test to confirm the resolution looks correct. |
|
@MelvinBot merge main here |
|
🤖 I wasn't able to merge I can only make code changes (including merging To have me do this, either |
|
@MelvinBot merge main |
|
⏱️ Ran out of time before I could finish. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in #melvinbot-ai. |
|
🚧 @MariaHCD 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! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/MariaHCD in version: 9.3.97-0 🚀
Bundle Size Analysis (Sentry): |
|
🤖 No help site changes required. This PR is a defensive UI fix: it hides the Freeze card button when a card is not in the The two help articles that document freezing remain accurate for the actual user-facing flow:
Why no update is needed
Since no docs changes are needed, I did not open a help site PR. @MariaHCD, please confirm you agree that no help site updates are required for this change. If you'd like a docs note added anyway (e.g. clarifying that freeze is only available for activated cards), let me know with |
|
@thesahindia @trjExpensify @lakchote This PR requires a physical card, Applause can't test this one, Could this be verified internally? |
|
@kavimuru, QA can test the steps mentioned below. This doesn't require physical card, card won't be activated by default.
|
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.3.97-1 🚀
|





Explanation of Change
The backend correctly rejects
FreezeCardrequests for cards not in theOPENstate (3), but the frontend was still showing the "Freeze card" button for non-OPEN cards (e.g.NOT_ACTIVATED). This adds a card state check so the freeze button only appears whencard.state === CONST.EXPENSIFY_CARD.STATE.OPEN, preventing users from triggering a guaranteed backend error.Two locations are fixed:
WorkspaceExpensifyCardDetailsPage.tsx): Replaced!isDeactivatedwith a stricterisCardOpencheckExpensifyCardPage/index.tsx): Added theOPENstate check (previously had no state guard at all)Fixed Issues
$ #84691
PROPOSAL: #84691 (comment)
Tests
Same as QA
Offline tests
Same as QA
QA Steps
Instance 1: Workspace Admin View (WorkspaceExpensifyCardDetailsPage)
Preconditions: You are a workspace admin with Expensify Card enabled on your workspace.
Test A — Card NOT in OPEN state (e.g. not activated):
Test B — Card in OPEN state:
Test C — Already frozen card:
Instance 2: Cardholder View (ExpensifyCardPage)
Preconditions: You are a cardholder with an assigned Expensify Card.
Test A — Card NOT in OPEN state:
Test B — Card in OPEN state:
Test C — Already frozen card:
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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari