Repository navigation
fix: drop pending domain adminship request when closing a user account - #101353
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@codex review |
|
🤖 Code review — the fix works for the happy path, but the optimistic update contradicts a deliberate design decision made ~450 lines above it in the same file, and the failure rollback is incomplete. 1. Dropping the requester optimistically breaks the offline/error affordance (medium)
Mirroring decline fixes both: optimistic sets 2. The cleared
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 84b2735808
ℹ️ 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".
0e1b7bd to
e91e29c
Compare
|
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". |
|
🤖 Re-verified against What changedYou adopted the
Removing the flag also removed the risk I flagged where the bulk path would silently no-op if Verified the unconditional write is safeDropping the flag means every close now writes an
One thing still openThe test plan hasn't been updated, and Offline is still
Minor, non-blocking
What I verified and what I didn'tVerified statically at Not verified: Jest and |
|
@MelvinBot could you assign @war-in to this PR? |
|
🤖 Done — added Note this only sets the assignee. If you also want |
| @@ -1478,12 +1487,21 @@ function closeUserAccount(domainAccountID: number, domain: string, targetEmail: | |||
| }, | |||
There was a problem hiding this comment.
Should we also clear adminshipRequesterErrors here
| key: `${ONYXKEYS.COLLECTION.DOMAIN_PENDING_ACTIONS}${domainAccountID}`, | ||
| value: { | ||
| member: {[targetEmail]: {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}}, | ||
| adminshipRequester: {[targetAccountID]: {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}}, |
There was a problem hiding this comment.
this looks like it's also written for members who never requested adminship. is this fine?
There was a problem hiding this comment.
yeah, it's harmless. I made sure to clear the entire object on success & failure
|
@MelvinBot update offline tests with 1. As a domain admin, go offline.
2. Go to Domain members > click a member who requested admin access > Close account > Force close account > Close account.
3. Go to Domain admins and verify the member is still in the Requests list, greyed out with a pending state.
4. Go back online and verify the member disappears from the Requests list. |
|
@MelvinBot mark PR as redy for review |
|
🤖 Updated the Offline tests section of the PR description with your steps (it previously said The steps match what the code does:
I could not verify this in a browser on this run — browser control was unavailable, so the above is from static analysis only. |
|
@ZhenjaHorbach 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] |
|
🤖 Done — this PR is now marked ready for review (no longer a draft). All checks on the latest commit were passing before the switch; the usual ready-for-review checks ( |
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: `${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`, | ||
| value: { | ||
| // eslint-disable-next-line @typescript-eslint/naming-convention | ||
| domain_adminRequesters: {[targetAccountID]: null}, | ||
| }, |
There was a problem hiding this comment.
do we need to re-add the targetAccountID to domain_adminRequesters in failureData?
There was a problem hiding this comment.
No we dont 😄 optimistic data doesn't touch domain_adminRequesters, so we don't have to restore anything on failure. While closing the account, we mark the request with a delete-pending action, so it appears crossed out
|
@ZhenjaHorbach we're ready for your review 😄 |
|
Will check after an hour! |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-09-24.at.12.47.16.movAndroid: mWeb ChromeScreen.Recording.2026-09-24.at.12.47.16.moviOS: HybridAppScreen.Recording.2026-09-24.at.12.43.15.moviOS: mWeb SafariScreen.Recording.2026-09-24.at.12.36.42.movMacOS: Chrome / SafariScreen.Recording.2026-09-24.at.12.32.15.mov |
|
🚧 mollfpr 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/mollfpr in version: 9.4.94-0 🚀
|
|
No help site changes are needed for this PR, so I did not create a docs PR. This PR fixes a bug. When a Domain Admin closed the account of a member who had asked for admin access, that member's request stayed in the Domain Admins Requests list. It doesn't add a feature, setting, or button, and it doesn't change any documented steps. Articles checked
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.4.94-0 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Fix stale pending adminship request entry in domain admin list after closing the user's account.
closeUserAccountnow drops thedomain_adminRequestersentry along with the member, and restores it if the call fails. It only works for the flow when an admin performs an action of closing a requester's account; when they close it themselves, the row stays until the admin clears the cache.Fixed Issues
$ #101042
PROPOSAL:
Tests
Precondition:
Offline tests
QA Steps
Same as Tests.
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
MacOS: Chrome / Safari
Screen.Recording.2026-09-16.at.17.06.15.mov