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

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

Closed
2 of 8 tasks
lanitochka17 opened this issue Jan 23, 2025 · 8 comments
Closed
2 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 23, 2025

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.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

@lanitochka17 lanitochka17 added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Jan 23, 2025
Copy link

melvin-bot bot commented Jan 23, 2025

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.

@samranahm
Copy link

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.

Copy link

melvin-bot bot commented Jan 27, 2025

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

@alitoshmatov
Copy link
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.

@muttmuure
Copy link
Contributor

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

@melvin-bot melvin-bot bot removed the Overdue label Jan 28, 2025
@muttmuure
Copy link
Contributor

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

@alitoshmatov
Copy link
Contributor

@melvin-bot melvin-bot bot added the Overdue label Jan 31, 2025
@muttmuure
Copy link
Contributor

Looks like we can close

@melvin-bot melvin-bot bot removed the Overdue label Feb 1, 2025
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. Daily KSv2
Projects
None yet
Development

No branches or pull requests

4 participants