-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$250] Expense - On changing 1st approver, 2nd approver is not greyed out&error for not added approvers #54524
Comments
Triggered auto assignment to @bfitzexpensify ( |
Job added to Upwork: https://www.upwork.com/jobs/~021871540038795816648 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @getusha ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.On changing 1st approver, 2nd approver is not greyed out&error for not added approvers What is the root cause of that problem?We have identified two separate bugs: Bug 1 (Steps 1 to 13): The app incorrectly greys out the approver The second approver is greyed out because the first approver has pendingFields.forwardsTo. However, when the first approver is updated, the pendingFields.forwardsTo of the first approver is not updated to reflect the new approver. This results in the second approver not being greyed out. Bug 2 (Steps 14 to 18): The app incorrectly adds approvers automatically When removing the second and third approvers in step 14, the changes are not saved. Consequently, in policy.employeeList, the first approver still forwards to the second approver, and the second approver forwards to the third approver. App/src/libs/actions/Workflow.ts Line 253 in d5cdd55
What changes do you think we should make in order to solve the problem?Solution for bug 1:App/src/libs/actions/Workflow.ts Line 280 in b1d0d70
We need to update the APPROVAL_WORKFLOW in onyx to migrate pendingFields.forwardsTo from the old approver to the new approver.
Additionally, we need to migrate the pendingFields.forwardTo from the approvalWorkflow to the employee list Line 238 in b1d0d70
Solution for bug 2:When removing an approver from the Approver Page, we need to introduce an additional field, perhaps named pendingRemove, in the clearApprovalWorkflowApprover function. This field will mark the approver as already removed from the current workflow. Then, we need to ensure that an approver is added automatically only if pendingRemove is false. App/src/libs/actions/Workflow.ts Line 253 in d5cdd55
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?Bug 1:We might need to add a new test for this scenario in https://github.com/Expensify/App/blob/main/tests/unit/WorkflowUtilsTest.ts This test will validate that pendingFields is correctly handled in the edit approval workflow. The input will consist of an employee list, and it will verify which indices should be greyed Bug 2:Testing this case is quite challenging, as it would be complicated to mock the test. However, if we still want to cover it with a unit test, we need to validate that the approver who was just deleted cannot be automatically added back to the approval chain What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.After changing 1st approver, 2nd approver is not greyed out & not added approvers are shown with error message. What is the root cause of that problem?
App/src/libs/actions/Workflow.ts Line 242 in ad99c20
After we click on the save button, we've had the logic to add Lines 237 to 239 in ad99c20
But it's overridden here when the Lines 256 to 258 in ad99c20
App/src/libs/actions/Workflow.ts Lines 253 to 255 in ad99c20
What changes do you think we should make in order to solve the problem?
App/src/libs/actions/Workflow.ts Line 242 in ad99c20
When we save the workflow, we should keep the rest pending field here
Lines 256 to 258 in ad99c20
App/src/libs/actions/Workflow.ts Lines 253 to 255 in ad99c20
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?What alternative solutions did you explore? (Optional)NA Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.78-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
Issue reported by: Applause Internal Team
Device used: Redmi note 10s Android 13
App Component: Money Requests
Action Performed:
Pre-condition: 1. Have a workspace with few members
2. Enable workflows and add approval flow
Expected Result:
After changing 1st approver, 2nd approver must be same as it was before changing 1st approver & not added approvers must not be shown with error message.
Actual Result:
After changing 1st approver, 2nd approver is not greyed out & not added approvers are shown with error message.
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6701635_1735015172299.Screenrecorder-2024-12-24-09-29-51-391_compress_1.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @getushaThe text was updated successfully, but these errors were encountered: