Allow selfApproval when the rule feature is disabled#55386
Conversation
|
@mountiny In this PR, FE allows the user to self-approve if the rule feature is disabled and |
|
@hungvu193 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] |
mountiny
left a comment
There was a problem hiding this comment.
Thanks! I am making change in the BE https://github.com/Expensify/Web-Expensify/pull/45169 that will make sure the preventSelfApproval value is reset to false when the rules feature is turned off.
Could you please make sure to update the optimisticData for the action that toggles the rules feature to reflect that. Can you please add unit tests for the action and for the isAllowedToApproveExpenseReport too?
| if (!policy?.areRulesEnabled) { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
I have made some backend changes where this will not be needed, actually this could lead to some older reports that never enabled or disabled the feature to skip this call because the default is false but they could have set the prevent self approval to true in OldDot
| if (!policy?.areRulesEnabled) { | |
| return true; | |
| } | |
| if (!policy?.areRulesEnabled) { | |
| return true; | |
| } |
There was a problem hiding this comment.
Oops, if we do that, doesn't that we should select TonyMK proposal?
There was a problem hiding this comment.
Yeah we could have, we can give TonyMK partial reward for their proposal
There was a problem hiding this comment.
Hey @mountiny, if there is no issue, could I raise a PR since my proposal initially addressed solving the root cause and @hungvu193 talked about this in his previous comment?
There was a problem hiding this comment.
Let me test in staging.
There was a problem hiding this comment.
@mountiny Tested in staging and it works well. cc @hungvu193 You can complete now.
There was a problem hiding this comment.
@mountiny Still the same, preventSelfApproval is still true, we still need to keep this block of code
There was a problem hiding this comment.
@hungvu193 Did you test with the staging server? I tested and it works well.
Screen.Recording.2025-01-22.at.22.28.23.mov
Sure will give an update soon. |
|
@mountiny I updated the unit test. |
| if (!policy?.areRulesEnabled) { | ||
| return true; | ||
| } |
|
@hungvu193 can you pleasse complete the testing and checklist? |
|
Sure. I'll do it today |
|
@hungvu193 lets please complete the checklist now, thanks! |
Reviewer Checklist
Screenshots/VideosAndroid: Nativentandr.movAndroid: mWeb ChromemChrome.moviOS: NativeScreen.Recording.2025-01-22.at.15.23.51.moviOS: mWeb SafarimSafari.movMacOS: Chrome / SafariChrome.movMacOS: DesktopDesktop.mov |
|
@mkzie2 sorry there are conflicts |
|
@mountiny The fix is done. |
|
✋ 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/mountiny in version: 9.0.90-0 🚀
|
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.90-6 🚀
|
|
|
||
| function isAllowedToApproveExpenseReport(report: OnyxEntry<Report>, approverAccountID?: number, reportPolicy?: OnyxEntry<Policy> | SearchPolicy): boolean { | ||
| const policy = reportPolicy ?? getPolicy(report?.policyID); | ||
| if (!policy?.areRulesEnabled) { |
There was a problem hiding this comment.
This, along with the backend not sending the areRulesEnabled value for the Reports tab, caused #58210. Now that individual flags are sent for each sub-option of rules, this was removed to fix it.
Explanation of Change
Allow selfApproval when the rule feature is disabled
Fixed Issues
$ #54206
PROPOSAL: #54206 (comment)
Tests
Offline tests
Same
QA Steps
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))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-01-17.at.13.53.06.mov
Android: mWeb Chrome
Screen.Recording.2025-01-17.at.13.48.56.mov
iOS: Native
Screen.Recording.2025-01-17.at.14.16.02.mov
iOS: mWeb Safari
Screen.Recording.2025-01-17.at.13.50.48.mov
MacOS: Chrome / Safari
Screen.Recording.2025-01-17.at.13.41.40.mov
MacOS: Desktop
Screen.Recording.2025-01-17.at.14.19.07.mov