Closed izarutskaya closed 3 weeks ago
Triggered auto assignment to @greg-schroeder (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
We think this issue might be related to the #collect project.
Approve button appears even when approvals are not required
In canApproveIOU
we do not check if the approvalMode
and autoReportingFrequency
are optional:
https://github.com/Expensify/App/blob/4fbd2184458a9cbfee0380b571fc95bff042c0af/src/libs/actions/IOU.ts#L4500
https://github.com/Expensify/App/blob/4fbd2184458a9cbfee0380b571fc95bff042c0af/src/libs/actions/IOU.ts#L4523-L4524
Add a check in canApproveIOU
to check if the approval mode and delay submittion are Optional
and if it is then return the value:
diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts
index b67e44fcf5..c361ed3e5e 100644
--- a/src/libs/actions/IOU.ts
+++ b/src/libs/actions/IOU.ts
@@ -4519,8 +4519,10 @@ function canApproveIOU(iouReport: OnyxEntry<OnyxTypes.Report> | EmptyObject, cha
const isOpenExpenseReport = isPolicyExpenseChat && ReportUtils.isOpenExpenseReport(iouReport);
const isApproved = ReportUtils.isReportApproved(iouReport);
const iouSettled = ReportUtils.isSettled(iouReport?.reportID);
+ const isApprovalOptional = policy?.approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL;
+ const canDelaySubmissions = policy?.autoReportingFrequency !== CONST.POLICY.AUTO_REPORTING_FREQUENCY.IMMEDIATE && policy?.autoReportingFrequency !== CONST.POLICY.AUTO_REPORTING_FREQUENCY.INSTANT;
- return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled;
+ return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled && !(isApprovalOptional && canDelaySubmissions);
}
N/A
The approve button is still displayed even though the add approvals option is disabled.
We already have a condition here to not show the approve button if the approval is disabled (isOnSubmitAndClosePolicy
).
https://github.com/Expensify/App/blob/4fbd2184458a9cbfee0380b571fc95bff042c0af/src/libs/actions/IOU.ts#L4509-L4513
However, the auto-reporting frequency needs to be instant (isOnInstantSubmitPolicy
) to not show the approval button. In our case, the frequency is set to WEEKLY, so the condition is never met.
Change the condition to accept either isOnInstantSubmitPolicy
or isOnSubmitAndClosePolicy
.
if (isOnInstantSubmitPolicy || isOnSubmitAndClosePolicy) {
Or we can remove isOnInstantSubmitPolicy
Job added to Upwork: https://www.upwork.com/jobs/~014fc34bb4b2bfbb10
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (External
)
@bernhardoj's proposal looks good to me
π π π C+ reviewed
Triggered auto assignment to @stitesExpensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@bernhardoj do you know why we initially implemented it to only be disabled when isOnInstantSubmitPolicy
? That seems like it was done intentionally, and I just want to make sure we aren't going to break something
It was first implemented in https://github.com/Expensify/App/pull/35470, but looks like in this PR https://github.com/Expensify/App/pull/38253 (where the QA found the issue), the test step expect the approve button to not show.
cc: @luacmartins @lakchote
We should not show the approve button if approvals are disabled
@luacmartins As mentioned here
Approver shouldn't be able to "Approve" an expense report IFF the report's policy is a Collect Policy, on "Instant Submit" reporting frequency, with "Submit & Close" approval mode.
Do we want to display the Approve button if users are in approval mode and not in "Instant Submit" reporting frequency
cc @Beamanator
Approver shouldn't be able to "Approve" an expense report IFF the report's policy is a Collect Policy, on "Instant Submit" reporting frequency, with "Submit & Close" approval mode.
Agreed (I wrote that lol)
Do we want to display the Approve button if users are in approval mode and not in "Instant Submit" reporting frequency
To be clear, you're asking "if users are in approval mode Submit & Close", right? I believe in that case we wouldn't want to show the "Approve" button either
Because "Submit & Close" basically means: After a submitter submits a report, what next? We close the report, we don't wait for the admin to Approve it
Because "Submit & Close" basically means: After a submitter submits a report, what next? We close the report, we don't wait for the admin to Approve it
That makes sense, but currently, the condition expects the instant submit is on too to hide the approve button. https://github.com/Expensify/App/blob/ebc8de8229fa700e5a7d08f4589db934a79d4f1d/src/libs/actions/IOU.ts#L4599-L4601
I think it makes sense if we remove the instant submit condition because whether it's an instant or manual submit, the report will be closed immediately, right?
I tentatively think that definitely makes sense π π
Discussion continues here - @stitesExpensify @Beamanator we cool with @bernhardoj's approach to solve this one?
I say let's move forward with always disabling / hiding the Approve button for Submit & Close approval mode, carlos agreed earlier too π
I say let's move forward with always disabling/hiding the Approve button for Submit & Close approval mode
Oh! If this is where we are heading to, then there is already a PR here for this. Not sure of the specifics of this issue but would the PR solve the issue here?
Ooh good catch! @greg-schroeder do you mind checking if this bug still exists? Maybe that linked PR ^ already fixed this!
Okay that was just deployed to prod. Asked QA to re-test here: https://expensify.slack.com/archives/C9YU7BX5M/p1712613747421269
@greg-schroeder @stitesExpensify @DylanDylann this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
Waiting for a re-test
Issue not reproducible during KI retests. (First week)
Aha, looks like it's no longer a thing! Closing accordingly per the above. Please reopen if you disagree and explain your reasoning!
Issue is still reproducible on the latest build 9.0.9-2
https://github.com/user-attachments/assets/c1731e4c-7d7c-43df-888a-8acd3cc99890
IOU - Approve button appears while approvals is disabled
In canApproveIOU
function we are not checking if the policy isSubmitAndClose
Add !PolicyUtils.isSubmitAndClose(policy)
to canApproveIOU result.
const result = isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled && !isArchivedReport && !PolicyUtils.isSubmitAndClose(policy);
Back into proposal review
@bernhardoj's proposal looks good to me
π π π C+ reviewed
Note that: The mentioned PR is another case and It doesn't fix this bug
Current assignee @stitesExpensify is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.
π£ @DylanDylann π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
PR is ready
cc: @DylanDylann
PR is being reviewed
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.15-9 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-08-09. :confetti_ball:
For reference, here are some details about the assignees on this issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
Payment summary:
Contributor: @bernhardoj - $500 - You can make a manual request C+: @DylanDylann - $500 - Paying through Upwork
Please complete the checklist @DylanDylann when you're able!
Requested in ND.
$500 approved for @bernhardoj
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: https://github.com/Expensify/App/pull/35470 [@DylanDylann] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: The author explained here [@DylanDylann] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: NA [@DylanDylann] Determine if we should create a regression test for this bug. Yes [@DylanDylann] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Regression Test Proposal
Prerequisite: Admin has a collect workspace and turns off the approval and sets the Delayed submission to MANUAL (or other than INSTANT)
Do we agree π or π
Filed regression test, closing
If you havenβt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.57-2 Reproducible in staging?: Y Reproducible in production?: Y Found when executing PR : https://github.com/Expensify/App/pull/38253 Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team
Action Performed:
Pre-requisites: Have a collect WS and make chat enabled on ND Have 2 accounts (one admin, one employee) Having `Make or track payments enabled Toggle on delay submissions on ND (Logged in as the admin) Toggle off Add approvals On OD Make reimbursement direct with a VBBA
Expected Result:
"Pay with expensify" button should show up since this is the case where Delay submissions is enabled and approvals is disabled
Actual Result:
"Approve" button appears on the header
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
https://github.com/Expensify/App/assets/115492554/4c0144dc-f6e3-4455-9c33-2db66596918b
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @greg-schroeder