Skip to content

Workspace - Workspace with an annual subscription can be deleted without an error #55666

Closed

Description

@lanitochka17

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.89-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: #54278
Issue reported by: Applause - Internal Team

Action Performed:

  1. Sign in to staging.new.expensify.com with a new account
  2. Create a new Workspace to start a subscription
  3. Go to "Subscriptions" and make sure it shows "Annual"
  4. Go to Workspaces and delete the newly created Workspace

Expected Result:

This will give an error Looks like you're on an annual subscription. Please downgrade your account from your account settings before trying again

Actual Result:

No error is displayed and workspace with an annual subscription can be deleted without changing subscription

Workaround:

Unknown

Platforms:

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

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

Screenshots/Videos

Add any screenshot/video evidence
Bug6722131_1737663128557.bandicam_2025-01-23_22-26-57-013.mp4

View all open jobs on GitHub

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 23, 2025
  2. melvin-bot commented on Jan 23, 2025

    @melvin-bot

    Triggered auto assignment to @muttmuure (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. samranahm commented on Jan 24, 2025

    @samranahm
    Contributor

    Proposal

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

    Workspace with an annual subscription can be deleted without an error

    What is the root cause of that problem?

    New Feature

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

    First initialise a new useState and function to downgrade the workspace to PAYPERUSE

    const [isDowngradeModalOpen, setIsDowngradeModalOpen] = useState(false);
    
    const handleDowngradeModal = (type:SubscriptionType) => {
            Subscription.updateSubscriptionType(type);
            return;
    }

    and then explicitly check if the Subscription type is annual before attempting to delete the workspace

    if (isOwner) {
    threeDotsMenuItems.push({
    icon: Expensicons.Trashcan,
    text: translate('workspace.common.delete'),
    onSelected: () => {
    if (isSupportalAction) {
    setIsSupportalActionRestrictedModalOpen(true);
    return;
    }
    setPolicyIDToDelete(item.policyID);
    setPolicyNameToDelete(item.title);
    setIsDeleteModalOpen(true);
    },
    shouldCallAfterModalHide: true,
    });

    onSelected: () => { 
    if (privateSubscription?.type === CONST.SUBSCRIPTION.TYPE.ANNUAL){
            setIsDowngradeModalOpen(true);
            return;
    }}

    Define a new ConfirmModal with onConfirm={handleDowngradeModal}

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    we can also redirect the user to Subscription settings page where they can change the type to PAYPERUSE before retying to attempt Workspace delete.
    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.

  4. melvin-bot commented on Jan 27, 2025

    @melvin-bot

    @muttmuure Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  5. alitoshmatov commented on Jan 27, 2025

    @alitoshmatov
    Contributor

    We anticipated this to happen. This is happening because it is hard to meet exact requirement for the said error to appear, this is also mention in original PR - #54278 (comment). We also got this response from internal member on how to reproduce this error, but neither I or contributor could reproduce it reliably. We tested expected result by manually simulating error in code.

    I am not sure how to handle this, as said above we tried everything to naturally reproduce this but no luck.

  6. muttmuure commented on Jan 28, 2025

    @muttmuure
    Contributor

    Don't we allow workspace deletion and annual subscription cancelation in the first month?

  7. muttmuure commented on Jan 28, 2025

    @muttmuure
    Contributor

    I'm not sure if what we're looking at here is a bug

  8. alitoshmatov commented on Jan 29, 2025

    @alitoshmatov
    Contributor
  9. muttmuure commented on Feb 1, 2025

    @muttmuure
    Contributor

    Looks like we can close

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

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions