Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import { useHistory } from 'react-router-dom'
import { planNames } from 'common/utils/utils'
import { Organisation } from 'common/types/responses'
import { useDeleteOrganisationWithToast } from 'components/pages/organisation-settings/hooks'
import ConfirmRemoveOrganisation from 'components/modals/ConfirmRemoveOrganisation'
Expand Down Expand Up @@ -53,7 +54,12 @@ export const DeleteOrganisation = ({
data-test='delete-org-btn'
onClick={handleDelete}
theme='danger'
disabled={isLoading}
disabled={
isLoading ||
(Utils.getPlanName(organisation.subscription?.plan ?? '') !==
planNames.free &&
!organisation.subscription?.cancellation_date)
}
Comment on lines +57 to +62

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would disable the button for all free accounts. We might want to use the planName directly, something like:
Utils.getPlanName(organisation.subscription?.plan ?? '') !== planNames.free && !organisation.subscription?.cancellation_date

@afsuyadi afsuyadi Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I just knew that planNames variable exists. Thanks for the additional info.

>
{isLoading ? 'Deleting...' : 'Delete Organisation'}
</Button>
Expand Down
Loading