[Home Page] Prevent Pay action from showing after user leaves workspace#81303
Conversation
|
@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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6f7c6d77a
ℹ️ 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".
9c42e71 to
a100d77
Compare
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari2026-02-03.19.53.14.mov |
|
LGTM! |
|
@grgia I fixed conflicts |
|
Is this case also missing an onyx update when the user leaves a workspace? |
I am not sure what are you asking for. Could you please explain this a little more? |
why is it stale? Is it because an onyx update is missing |
|
When leaving a workspace, only |
|
🚧 @grgia 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/grgia in version: 9.3.16-0 🚀
|
|
@adamgrzybowski can you look? This may have caused #81955 (comment) |
|
@adamgrzybowski Any QA steps for this? Thanks |
The workspace membership check added in #81303 to prevent the Pay button from showing after a user leaves a workspace was too broad. It blocked all reports with a policyID, including IOU reports (personal 1:1 expenses) that inherit a policyID from the chat report. The receiver of such an IOU may not have access to the sender's workspace policy, causing isPayer to incorrectly return false. Skip the workspace membership check for IOU reports since they are personal expenses where the payer should always be able to pay if they are the manager, regardless of workspace membership. Co-authored-by: Cursor <cursoragent@cursor.com>
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.3.16-9 🚀
|
| // employeeList may be lazily loaded/partial, so only check if it's present | ||
| if (isPaidGroupPolicy(iouReport) && !isEmptyObject(policy?.employeeList) && !isPolicyMemberWithoutPendingDelete(currentUserEmailParam, policy)) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Hi @adamgrzybowski,
We’re seeing a case here where employeeList is partially loaded and does not include the current user, which causes isPayer to return false.
Do you think it makes sense to guard this by checking
!isEmptyObject(policy?.employeeList?.[currentUserEmailParam]),
or should the backend guarantee that the current user is always included even when returning a partial list?
There was a problem hiding this comment.
Not sure if the guard you mentioned solves our problem completely. This partial list behavior is a potential trap for other upcoming features so maybe let's fix the backend? But I don't have a strong opinion on this one
There was a problem hiding this comment.
Ahh, the BE fix looks more comprehensive—let’s get @grgia thought on it.
There was a problem hiding this comment.
should the backend guarantee that the current user is always included even when returning a partial list?
Yes, though it should already do this.
Reverts the employeeList/membership-based gating added in Expensify#81303 so the Export to integration action is no longer hidden when policy.employeeList is only partially loaded. Co-authored-by: ahmedGaber93 <ahmedGaber93@users.noreply.github.com>
Explanation of Change
Prevent Pay action from showing after user leaves workspace
The
isPayerhelper now verifies workspace membership before allowing the Pay action. Previously, when a user left a workspace, the Pay button could still appear because the function didn't check if the user was still a member.Changes
falsewhen policy data is unavailable (indicates user left workspace)isPolicyMemberWithoutPendingDeleteto catch cases wherepolicy.rolemay be staleFixed Issues
$ #81096
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
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: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-02-03.at.14.09.19.mov