Show no-access modal when delegate tries to update copilots#78110
Conversation
|
@truph01 is the assigned C+. |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
| icon: icons.Pencil, | ||
| onPress: () => { | ||
| if (isDelegateAccessRestricted) { | ||
| if (isDelegateAccessRestricted || isActingAsDelegate) { |
There was a problem hiding this comment.
| if (isDelegateAccessRestricted || isActingAsDelegate) { | |
| if (isActingAsDelegate) { |
| icon: Expensicons.Trashcan, | ||
| onPress: () => { | ||
| if (isDelegateAccessRestricted) { | ||
| if (isDelegateAccessRestricted || isActingAsDelegate) { |
There was a problem hiding this comment.
| if (isDelegateAccessRestricted || isActingAsDelegate) { | |
| if (isActingAsDelegate) { |
| if (isActingAsDelegate) { | ||
| setShouldShowRemoveDelegateModal(false); | ||
| showDelegateNoAccessModal(); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Why do we need this logic? We already prevent the user from clicking the "Remove Copilot" button, so is there any chance this logic could still be triggered?
There was a problem hiding this comment.
If the session flips to "acting as delegate" after the modal is already open (e.g., user switches to a delegator account in another tab and returns, or future code opens the modal from some other entry point), this check can be useful. What do you think?
There was a problem hiding this comment.
@grgia Because if the user somehow views the modal and clicks on confirm, but they are a delegate, then the remove-copilot modal will close and instead the "no-access" one will show.
There was a problem hiding this comment.
Do you have a video of this flow on your branch
There was a problem hiding this comment.
Screen.Recording.2025-12-20.at.3.51.12.PM.mov
Screen.Recording.2025-12-20.at.3.49.46.PM.mov
| if (isActingAsDelegate) { | ||
| showDelegateNoAccessModal(); | ||
| return; | ||
| } |
There was a problem hiding this comment.
I don’t think we need this logic. We can still allow users to open the popover, but prevent them from selecting certain options within it.
|
@grgia Sorry, I mistakenly approved this PR. Please hold off on your review until I finish it on my side. |
| }), | ||
| // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps | ||
| [delegates, translate, styles, personalDetails, errorFields, windowWidth, selectedEmail], | ||
| [delegates, translate, styles, personalDetails, errorFields, windowWidth, selectedEmail, isActingAsDelegate, showDelegateNoAccessModal], |
There was a problem hiding this comment.
| [delegates, translate, styles, personalDetails, errorFields, windowWidth, selectedEmail, isActingAsDelegate, showDelegateNoAccessModal], | |
| [delegates, translate, styles, personalDetails, errorFields, windowWidth, selectedEmail], |
|
@ShridharGoel Could you help merge main? |
| icon: icons.Pencil, | ||
| onPress: () => { | ||
| if (isDelegateAccessRestricted) { | ||
| if (isActingAsDelegate) { |
There was a problem hiding this comment.
@ShridharGoel Is it in the scope of this issue?
There was a problem hiding this comment.
I think we should be doing it to ensure that change access levels is also restricted. Do you think we should revert this?
There was a problem hiding this comment.
I think we should revert. Because in the OP of the bug, it only mentioned "Remove copilot" option, not the "Change access level" option
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-12-23.at.22.17.18.movAndroid: mWeb ChromeScreen.Recording.2025-12-23.at.22.13.58.moviOS: HybridAppScreen.Recording.2025-12-23.at.22.16.38.moviOS: mWeb SafariScreen.Recording.2025-12-23.at.22.10.43.movMacOS: Chrome / SafariScreen.Recording.2025-12-23.at.22.09.07.mov |
|
Merged main |
|
@grgia This is ready for your review. |
|
@Valforte Do you think this can be merged? |
|
✋ 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/Valforte in version: 9.2.89-1 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.2.89-6 🚀
|
Explanation of Change
Show no-access modal when delegate tries to update copilots
Fixed Issues
$ #77446
PROPOSAL: #77446 (comment)
Tests
Precondition: The main Expensifail account has set up Full and Limit copilots in the Security section
Offline tests
QA Steps
Same as tests.
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
Screen.Recording.2025-12-19.at.3.39.04.PM.mov
Android: mWeb Chrome
Screen.Recording.2025-12-19.at.3.44.00.PM.mov
iOS: Native
Screen.Recording.2025-12-19.at.3.32.19.PM.mov
iOS: mWeb Safari
Screen.Recording.2025-12-19.at.3.33.42.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2025-12-19.at.3.28.24.PM.mov