-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: don't show Pay button to non-admin approvers #60939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@jayeshmangwani 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] |
@nkdengineer, adding a test for |
@jayeshmangwani i added |
@nkdengineer Tests are failing |
@nkdengineer ⬆️ |
Can you update step 2 in Tests to be more explicit? We can't directly set the user as the approver—we have to configure it through workflows. |
@nkdengineer can you address the comments today, please? Thanks! |
Yes, I'm testing some other problems from the tests will give an update today or tomorrow morning. |
@jayeshmangwani I fixed the test. Instead of replacing |
@nkdengineer Just circling back—could you add a bit more detail for Step 2? Specifically, how do you set the approver? |
@jayeshmangwani Updated the test step. |
src/libs/ReportUtils.ts
Outdated
if (!policy?.achAccount?.reimburser) { | ||
return isManager; | ||
return isAdmin && isManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@puneetlath, do we have any context on OldDot for this specific condition?
If there's no reimburser
, is it necessary to check both isAdmin && isManager
, or is just the isAdmin
check sufficient here?
cc: @nkdengineer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, just seeing this comment. Hm, I think in OldDot all admins see the ability to mark the report as reimbursed. Right @heyjennahay? So I think just the isAdmin
check should be sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkdengineer can we update this based on Jenna's comment below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@puneetlath I updated.
Reviewer Checklist
Screenshots/Videos |
@puneetlath, before merging the PR, is it possible to test this PR with the user who originally encountered it? From the screenshot, it looks like Jon is able to reproduce the issue. When I tested the app on staging using the |
Agree with @jayeshmangwani, we need the user who has the data to confirm this bug is fixed. |
🚧 @puneetlath has triggered a test app build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
Great, we're all set to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
src/libs/ReportUtils.ts
Outdated
if (!policy?.achAccount?.reimburser) { | ||
return isManager; | ||
return isAdmin && isManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, just seeing this comment. Hm, I think in OldDot all admins see the ability to mark the report as reimbursed. Right @heyjennahay? So I think just the isAdmin
check should be sufficient.
src/libs/ReportUtils.ts
Outdated
const isReimburser = session?.email === policy?.achAccount?.reimburser; | ||
return isReimburser && (isApproved || isManager); | ||
return isReimburser && (isApproved || isAdmin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'm not sure about this scenario being changed. I think what it is meant to do is:
- If I am not the reimburser, but I am the manager, then I can approve it
- If I am the reimburser, and I am the manager, then I can pay it (which will also approve it)
- If I am neither the reimburser nor the manager, no matter whether I'm an admin or not, then I can't approve or pay it. I have to wait for it to be approved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@puneetlath Do you mean we should check (isAdmin && isManger) here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some weirdness in OldDot but yes ideally all Admins should have the ability to mark a report as reimbursed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkdengineer I think the original logic was right. Is changing it necessary for fixing the bug?
Or maybe I'm not understanding the scenario when we would hit this condition. Can you explain it to me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@puneetlath Please help to clarify here, do we want to keep the current behavior on main here or update like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And reimburser
isn't an admin right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are an admin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@puneetlath To clarify, I want to ask the data of the result you showed here. What is the reimbursementChoice
of the policy, the user who is viewing the report is an admin or not and is the user the reimburser of the policy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah the policy is set to direct reimbursement and has a reimburser. The person taking the screenshot (me) is not an admin or reimburser on the policy. Just a regular approver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@puneetlath Thanks for your information, I think we can keep this condition as it is on main. I updated it, please help to verify this result is still the same.
🚧 @puneetlath has triggered a test app build. You can view the workflow run here. |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
🚧 @puneetlath has triggered a test app build. You can view the workflow run here. |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and it seems to work correctly.
✋ 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/puneetlath in version: 9.1.45-0 🚀
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 9.1.45-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.1.45-21 🚀
|
Explanation of Change
Fixed Issues
$ #60722
PROPOSAL: #60722 (comment)
Tests
user
orauditor
Offline tests
Same as tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectioncanBeMissing
param foruseOnyx
toggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov
MacOS: Desktop