Repository navigation
Fix change workspace condition - #62062
Conversation
|
@MarioExpensify 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/VideosMacOS: Chrome / Safari- ExpenseScreen.Recording.2025-05-21.at.17.46.41.mp4Uploading Screen Recording 2025-05-22 at 11.37.28.mp4… - IOUPaid Screen.Recording.2025-05-22.at.11.35.28.mp4UnPaid Uploading Screen Recording 2025-05-22 at 11.50.15.mp4… - Invoice & otherScreen.Recording.2025-05-22.at.11.58.34.mp4MacOS: Desktop- ExpenseScreen.Recording.2025-05-22.at.12.09.29.mp4- IOU & otherAndroid: HybridAppScreen.Recording.2025-05-22.at.12.11.19.mp4Android: mWeb ChromeScreen.Recording.2025-05-22.at.12.22.30.mp4iOS: HybridAppScreen.Recording.2025-05-22.at.12.26.54.mp4iOS: mWeb SafariScreen.Recording.2025-05-22.at.12.26.54.mov |
| function isWorkspaceEligibleForReportChange(newPolicy: OnyxEntry<Policy>, report: OnyxEntry<Report>, policies: OnyxCollection<Policy>): boolean { | ||
| const submitterEmail = getLoginByAccountID(report?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID); | ||
| return isPaidGroupPolicyPolicyUtils(newPolicy) && (isPolicyMember(submitterEmail, newPolicy?.id) || isPolicyAdmin(newPolicy?.id, policies)); |
There was a problem hiding this comment.
NAB: Currently, the solution section lacks a description of this change, so we can't verify this logic.
There was a problem hiding this comment.
Yea, I need to update the doc with this logic.
There was a problem hiding this comment.
I think this change returns incorrect available workspaces
Screen.Recording.2025-05-21.at.17.25.16.mp4
There was a problem hiding this comment.
Ah the workspaces are correct, but this request is failing with 411 Cannot create policy expense chat for non Policy member. I have a BE PR to add support for this, but basically we'll need a method similar to MoveIOUReportToPolicyAndInviteSubmitter, but for paid policies
There was a problem hiding this comment.
BE PR is still WIP. @suneox let's continue review here and not block on that.
There was a problem hiding this comment.
I got it. Overall, the change set is look good. I'm just a bit confused about this part, so I'll continue the checklist based on the current state.
|
I need more time to compare with old dot and will complete the checklist today |
MarioExpensify
left a comment
There was a problem hiding this comment.
Code LGTM!! @suneox please let me know when it is ready to merge!
suneox
left a comment
There was a problem hiding this comment.
Overall, the change set LGTM. We can verify available ws issue later after BE ready
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Performance Comparison Report 📊 (1/3)Significant Changes To Duration
Show details
|
Performance Comparison Report 📊 (2/3)Meaningless Changes To Duration (1/2)Show entries
Show details
|
Performance Comparison Report 📊 (3/3)Meaningless Changes To Duration (2/2)Show entries
Show details
|
|
@Expensify/mobile-deployers 📣 Please look into this performance regression as it's a deploy blocker. |
|
🚀 Deployed to staging by https://github.com/MarioExpensify in version: 9.1.51-0 🚀
|
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.1.51-6 🚀
|
|
For these steps, the “Move workspace” option shows up in the header, but the backend rejects it, saying that the IOU and workspace payer must be the same. Screen.Recording.2025-05-30.at.8.08.55.PM.movShould we show this option only if the IOU and workspace have the same payer? We are working on a PR that uses the isPayer logic for the workspace payer to show this option only when the backend condition matches. Is this fine? |
Yes. Additionally, besides the payer being the same, we can only update the IOU's workspace if all requests come from the same user. So for example: Scenario 1:
Scenario 2:
|
| isCurrentUserAdmin && | ||
| verifyState(report, [CONST.REPORT.STATE_NUM.APPROVED]) && | ||
| verifyStatus(report, [CONST.REPORT.STATUS_NUM.APPROVED, CONST.REPORT.STATUS_NUM.REIMBURSED, CONST.REPORT.STATUS_NUM.CLOSED]) | ||
| ) { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Coming from the #76421 checklist: during the refactor and cleanup of conditions, we missed this case. As a result, the available workspace is shown, but the backend prevents the change
| return false; | ||
| function isWorkspaceEligibleForReportChange(newPolicy: OnyxEntry<Policy>, report: OnyxEntry<Report>, policies: OnyxCollection<Policy>): boolean { | ||
| const submitterEmail = getLoginByAccountID(report?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID); | ||
| return isPaidGroupPolicyPolicyUtils(newPolicy) && (isPolicyMember(submitterEmail, newPolicy?.id) || isPolicyAdmin(newPolicy?.id, policies)); |
There was a problem hiding this comment.
Coming from #79075. We should also check here for isPendingDeletePolicy otherwise the change workspace option will be shown whilst offline.
| if (isSubmitted) { | ||
| return (isSubmitter && isAwaitingFirstLevelApproval(report)) || isManager || isAdmin; | ||
| } |
There was a problem hiding this comment.
This behavior is now considered incorrect and was removed in #88530
Explanation of Change
Refactors the logic for displaying the
Change workspacesecondary action option as follows:Fixed Issues
$ #62337
Tests
Pre-condition:
Change workspaceoptionChange workspaceoptionChange workspaceChange workspaceChange workspaceOffline tests
N/A
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))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
Screen.Recording.2025-05-19.at.4.47.23.PM.mov
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop