Skip to content

Unable to delete newly created workspace in new account #41357

Closed

Description

@m-natarajan

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.68-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @Puneet-here
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1714499352473189

Action Performed:

  1. Created a new account in staging.new.expensify.com
  2. Create a new workspace
  3. Select the created workspace
  4. Click three dot menu and delete the workspace

Expected Result:

Workspace deleted

Actual Result:

Unable to delete workspace and "Looks like you're on an annual subscription. Please downgrade your account from your account settings before trying again" error

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

image (21)

delete.newly.created.workspace.mp4

Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fc08a6832d88aa3c
  • Upwork Job ID: 1785688967359610880
  • Last Price Increase: 2024-05-22
Issue OwnerCurrent Issue Owner: @mjasikowski

Activity

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

    @melvin-bot

    Triggered auto assignment to @dylanexpensify (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. trjExpensify commented on May 1, 2024

    @trjExpensify
    Contributor

    I ran into this myself today.

    1. I was able to delete the same workspace on OldDot, but not NewDot.
    2. I checked I was still in the 7-day free trial window

    Logs are here (internal only, sorry).

    Throw ExpException - a8948deec2009297362f103209a7a026 ~~ message: '401 Can't delete last policy under a yearly subscription' exceptionMessage: 'Auth DeletePolicy returned an error' exceptionFile: '/git/releases/expensify.com/64247c4/lib/Auth.php' exceptionLine: '125' exceptionCode: '401'
    

    I'm hitting this block when I don't think I should be: https://github.com/Expensify/Auth/blob/01554c45bd48e4cae90b02a23e96f943cb90698c/auth/lib/Policy.cpp#L2755-L2761

    So I think somehow NewDot isn't recognising that the workspace I'm trying to delete is on a free trial and it's throwing this error.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 1, 2024
  5. melvin-bot commented on May 1, 2024

    @melvin-bot
  6. changed the title [-]Unable to delete newly created workspace in new account[/-] [+][$250] Unable to delete newly created workspace in new account[/+] on May 1, 2024
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 1, 2024
  8. melvin-bot commented on May 1, 2024

    @melvin-bot

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

  9. trjExpensify commented on May 1, 2024

    @trjExpensify
    Contributor

    Sending external for more eyes.

  10. 178 remaining items

  11. mjasikowski commented on Nov 22, 2024

    @mjasikowski
    Contributor

    Sorry for unassigning, the github assignee dropdown played some weird tricks on me.

  12. mjasikowski commented on Nov 22, 2024

    @mjasikowski
    Contributor

    Allowing the policy to be deleted if it's during the free trial seems to be pretty easy (I'm often wrong when I say that). But should there be any additional criteria to check?

    What should happen to the subscription afterwards (it's automatically set to yearly when on a free trial), should it be cancelled or stay as is? Are there any edge cases that we should think about here?

  13. carlosmiceli commented on Nov 22, 2024

    @carlosmiceli
    Contributor

    @mjasikowski hello sir, can you confirm that your fix would solve this issue?

  14. mjasikowski commented on Nov 23, 2024

    @mjasikowski
    Contributor

    @carlosmiceli Can't confirm yet. I'll let you know when I figure out the complete workflow.

  15. mjasikowski commented on Nov 26, 2024

    @mjasikowski
    Contributor

    @garrettmknight @carlosmiceli @alexpensify @trjExpensify I made some changes to my draft PR. Let me know if the following solution works for you in principle:

    1. When running the DeletePolicy command, auth.policy.validateCanDelete no longer will return an error when you are deleting the last paid policy while on the yearly plan, but only if the following conditions are met:
      • remaining policy has no items that should be billed (shouldBillLastPolicy)
      • the allowDowngrade function param is set to true (defaults to false, but will be true just for the DeletePolicy command)
      • account has no purchases (Account::canDowngrade(db, accountID))
    2. If the above conditions are met, subscription type will be downgraded from yearly to monthly, and the policy will be deleted

    There's no condition for free trials here, because free trial is triggered only if a billable action was made in a policy.
    If you agree with the above process, I'll submit the PR to review.

  16. garrettmknight commented on Nov 27, 2024

    @garrettmknight
    Contributor
  17. alexpensify commented on Dec 5, 2024

    @alexpensify
    Contributor

    @mjasikowski—I'm back from Holiday and catching up. I reviewed the Slack conversation, and it looks like we are all set to continue here. Is there any update on when the PR will be ready? Thanks!

  18. mjasikowski commented on Dec 5, 2024

    @mjasikowski
    Contributor

    @alexpensify the PR is already merged!

  19. alexpensify commented on Dec 5, 2024

    @alexpensify
    Contributor

    Whoops, sorry I missed it. Can you share the PR link here? I don't see one associated with this GH. Thanks!

  20. mjasikowski commented on Dec 5, 2024

    @mjasikowski
    Contributor
  21. alexpensify commented on Dec 12, 2024

    @alexpensify
    Contributor

    @mjasikowski - since the PR was merged, can we close this one or are we waiting for another update? Thanks!

  22. mjasikowski commented on Dec 12, 2024

    @mjasikowski
    Contributor

    @alexpensify let's close it!

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

Metadata

Metadata

Labels

InternalRequires API changes or must be handled by Expensify staffNewFeatureSomething to build that is a new item.ReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions