Skip to content
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] Approver - Existing approver settings reverts to default after upgrading workspace plan #50924

Open
8 tasks done
IuliiaHerets opened this issue Oct 16, 2024 · 17 comments
Open
8 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Oct 16, 2024

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.49-1
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  • Workspace is under Collect plan.
  • Workspace has at least two members.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Workflows.
  3. Enable Add approvals.
  4. Click on the existing approval workflow.
  5. Click Approver.
  6. Select another member as approver and save it.
  7. Click Additional approver.
  8. Upgrade the plan.
  9. Click Got it, thanks.

Expected Result:

The existing approver settings in Step 6 will be preserved.

Actual Result:

The existing approver settings in Step 6 reverts to default after upgrading workspace plan.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6636230_1729067871531.20241016_163338.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021847030936559806669
  • Upwork Job ID: 1847030936559806669
  • Last Price Increase: 2024-10-17
  • Automatic offers:
    • ishpaul777 | Reviewer | 104559184
Issue OwnerCurrent Issue Owner: @ishpaul777
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 16, 2024
Copy link

melvin-bot bot commented Oct 16, 2024

Triggered auto assignment to @joekaufmanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@IuliiaHerets
Copy link
Author

We think that this bug might be related to #wave-control

@IuliiaHerets
Copy link
Author

@joekaufmanexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@bernhardoj
Copy link
Contributor

bernhardoj commented Oct 16, 2024

Edited by proposal-police: This proposal was edited at 2024-10-16 17:02:28 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

Edit to the approval workflow is reset after upgrading the workspace from the additional approver flow.

What is the root cause of that problem?

When we go back from the upgrade page, we will call dismissModal which will dismiss the whole RHP including the ongoing edit approval flow.

onBackButtonPress={() => {
if (isUpgraded) {
Navigation.dismissModal();
goBack();

Then, we call goBack which navigates to the backTo params, in our case, the edit approval flow.

switch (feature.id) {
case CONST.UPGRADE_FEATURE_INTRO_MAPPING.reportFields.id:
case CONST.UPGRADE_FEATURE_INTRO_MAPPING.rules.id:
case CONST.UPGRADE_FEATURE_INTRO_MAPPING.companyCards.id:
return Navigation.navigate(ROUTES.WORKSPACE_MORE_FEATURES.getRoute(policyID));
default:
return route.params.backTo ? Navigation.navigate(route.params.backTo) : Navigation.goBack();
}

Because the page is closed and then reopened, the flow is restarted.

What changes do you think we should make in order to solve the problem?

Don't always call dismissModal. For the approval feature, just go back and navigate with the fallback route. For all other existing cases, keep the dismissModal to not change the other existing behavior.

switch (feature.id) {
    case CONST.UPGRADE_FEATURE_INTRO_MAPPING.approvals.id:
        Navigation.goBack();
        if (route.params.backTo) {
            Navigation.navigate(route.params.backTo);
        }
        return;
    case CONST.UPGRADE_FEATURE_INTRO_MAPPING.reportFields.id:
    case CONST.UPGRADE_FEATURE_INTRO_MAPPING.rules.id:
    case CONST.UPGRADE_FEATURE_INTRO_MAPPING.companyCards.id:
        Navigation.dismissModal();
        return Navigation.navigate(ROUTES.WORKSPACE_MORE_FEATURES.getRoute(policyID));
    default:
        Navigation.dismissModal();
        return route.params.backTo ? Navigation.navigate(route.params.backTo) : Navigation.goBack();
}

Then, we can remove the dismissModal from here.

if (isUpgraded) {
Navigation.dismissModal();
goBack();
} else {
Navigation.goBack();
}
}}
/>
{isUpgraded && (
<UpgradeConfirmation
onConfirmUpgrade={() => {
Navigation.dismissModal();
goBack();

@nkdengineer
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

The existing approver settings in Step 6 reverts to default after upgrading workspace plan.

What is the root cause of that problem?

After calling the UpgradeToCorporate function, we have updated the policy type and the Workflow.setApprovalWorkflow function will be called in this useEffect => it has reverted to default approver

Workflow.setApprovalWorkflow({
...currentApprovalWorkflow,
availableMembers: [...currentApprovalWorkflow.members, ...defaultWorkflowMembers],
usedApproverEmails,
action: CONST.APPROVAL_WORKFLOW.ACTION.EDIT,
isLoading: false,
errors: null,
});
setInitialApprovalWorkflow(currentApprovalWorkflow);

What changes do you think we should make in order to solve the problem?

We will not reset the approval workflow when the policy type changes.

    const policyType = policy?.type;
    const previousType = usePrevious(policy?.type);


   if(policyType !== previousType){
            Workflow.setApprovalWorkflow({
                ...currentApprovalWorkflow,
                availableMembers: [...currentApprovalWorkflow.members, ...defaultWorkflowMembers],
                usedApproverEmails,
                action: CONST.APPROVAL_WORKFLOW.ACTION.EDIT,
                isLoading: false,
                errors: null,
            });
        }

What alternative solutions did you explore? (Optional)

@joekaufmanexpensify
Copy link
Contributor

Reproduced.

@joekaufmanexpensify joekaufmanexpensify added the External Added to denote the issue can be worked on by a contributor label Oct 17, 2024
@melvin-bot melvin-bot bot changed the title Approver - Existing approver settings reverts to default after upgrading workspace plan [$250] Approver - Existing approver settings reverts to default after upgrading workspace plan Oct 17, 2024
Copy link

melvin-bot bot commented Oct 17, 2024

Job added to Upwork: https://www.upwork.com/jobs/~021847030936559806669

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 17, 2024
Copy link

melvin-bot bot commented Oct 17, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @ishpaul777 (External)

@joekaufmanexpensify
Copy link
Contributor

Pending @ishpaul777 review of proposals

@melvin-bot melvin-bot bot added the Overdue label Oct 21, 2024
@ishpaul777
Copy link
Contributor

Thanks for ping, i'll review in couple hours

@melvin-bot melvin-bot bot removed the Overdue label Oct 21, 2024
@joekaufmanexpensify
Copy link
Contributor

Great. TY!

@ishpaul777
Copy link
Contributor

I swear i am on it today 🙇

@ishpaul777
Copy link
Contributor

Proposal from @bernhardoj works well and LGTM!

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Oct 22, 2024

Triggered auto assignment to @MarioExpensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@MarioExpensify
Copy link
Contributor

Very well, proposal looks good @bernhardoj!! Thank you @ishpaul777, let's move forward.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 23, 2024
Copy link

melvin-bot bot commented Oct 23, 2024

📣 @ishpaul777 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Oct 24, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @ishpaul777

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
Status: Release 3: Fall 2024 (Nov)
Development

No branches or pull requests

6 participants