Skip to content

[HOLD for payment 2024-11-11] [$250] Approver - Existing approver settings reverts to default after upgrading workspace plan #50924

Closed

Description

@IuliiaHerets

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: 9.0.49-1
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): applausetester+kh081006@applause.expensifail.com
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: @joekaufmanexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 16, 2024
  2. melvin-bot commented on Oct 16, 2024

    @melvin-bot

    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.

  3. IuliiaHerets commented on Oct 16, 2024

    @IuliiaHerets
    Author

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

  4. IuliiaHerets commented on Oct 16, 2024

    @IuliiaHerets
    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

  5. bernhardoj commented on Oct 16, 2024

    @bernhardoj
    Contributor

    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();

  6. nkdengineer commented on Oct 16, 2024

    @nkdengineer
    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)

  7. joekaufmanexpensify commented on Oct 17, 2024

    @joekaufmanexpensify
    Contributor

    Reproduced.

  8. 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[/+] on Oct 17, 2024
  9. melvin-bot commented on Oct 17, 2024

    @melvin-bot
  10. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 17, 2024
  11. 29 remaining items

  12. melvin-bot commented on Nov 4, 2024

    @melvin-bot

    @ishpaul777 @joekaufmanexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  13. joekaufmanexpensify commented on Nov 4, 2024

    @joekaufmanexpensify
    Contributor

    Payment due next week! @ishpaul777 could you tackle checklist this week?

  14. joekaufmanexpensify commented on Nov 11, 2024

    @joekaufmanexpensify
    Contributor
  15. ishpaul777 commented on Nov 11, 2024

    @ishpaul777
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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: https://github.com/Expensify/App/pull/48673/files#r1836862383

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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. Not critical, minor issue

      Link to discussion: No need

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.- Not required one time issue now solved.

  16. joekaufmanexpensify commented on Nov 11, 2024

    @joekaufmanexpensify
    Contributor

    Will handle payment today

  17. joekaufmanexpensify commented on Nov 11, 2024

    @joekaufmanexpensify
    Contributor

    Checklist is all set here. We need to pay:

  18. joekaufmanexpensify commented on Nov 11, 2024

    @joekaufmanexpensify
    Contributor

    @ishpaul777 $250 sent and contract ended

  19. joekaufmanexpensify commented on Nov 11, 2024

    @joekaufmanexpensify
    Contributor

    Upwork job closed.

  20. joekaufmanexpensify commented on Nov 11, 2024

    @joekaufmanexpensify
    Contributor

    Closing as all that's left here is for @bernhardoj to request payment via NewDot. Please do this at your earliest convenience!

  21. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Nov 11, 2024
  22. bernhardoj commented on Nov 12, 2024

    @bernhardoj
    Contributor

    Requested in ND.

  23. JmillsExpensify commented on Nov 12, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions