Skip to content

fix(organisation): disable delete button when active subscription exists#7809

Merged
Zaimwa9 merged 3 commits into
Flagsmith:mainfrom
afsuyadi:fix/prevent-deletion-chargebee-subscription
Jul 2, 2026
Merged

fix(organisation): disable delete button when active subscription exists#7809
Zaimwa9 merged 3 commits into
Flagsmith:mainfrom
afsuyadi:fix/prevent-deletion-chargebee-subscription

Conversation

@afsuyadi

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • [✔] I have read the Contributing Guide.
  • [ ] I have added information to docs/ if required so people know about the feature.
  • [✔] I have filled in the "Changes" section below.
  • [✔] I have filled in the "How did you test this code" section below.

Changes

Contributes to #7700

  1. In DeleteOrganisation.tsx, the button Delete Organisation is disabled only when isLoading is true.
  2. However to prevent it being active, we need to add more condition which is related to billing subscription.
  3. The component DeleteOrganisation receives Organisation data, which has Subscription property.
  4. The interface Subscription itself accepts 2 properties; plan and cancellation_date, for which we can use them as the guarding condition.
  5. The Delete Organisation button will remain disabled if plan !== null and cancellation_date === null.

How did you test this code?

  1. In local, it's quite difficult for me to find the Billing tab under Organisation Settings and make sure both of the condition has disabled Delete Organisation button, though I can see it in the deployed flagsmith app (https://app.flagsmith.com/).
  2. To navigate through this, I use Python Shell to manipulate the database's data, and console.log to see the manipulated value of plan and cancellation_date.

Before changes:
Screencast from 18-06-26 08:44:50.webm

Input for python shell:

from organisations.models import Subscription
sub = Subscription.objects.first()
sub.plan = 'startup'
sub.cancellation_date = None
sub.save()
print(sub.id, sub.plan, sub.cancellation_date)

Input for console.log:

{console.log(
          organisation.subscription.plan,
          organisation.subscription.cancellation_date,
        )}

Output of python shell:
image

Output of console.log:
Screencast from 18-06-26 09:11:24.webm

@afsuyadi afsuyadi requested a review from a team as a code owner June 18, 2026 02:41
@afsuyadi afsuyadi requested review from kyle-ssg and removed request for a team June 18, 2026 02:41
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

@afsuyadi is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label Jun 18, 2026
@manos-saratsis

This comment was marked as spam.

@Zaimwa9 Zaimwa9 assigned Zaimwa9 and unassigned kyle-ssg Jun 23, 2026
@Zaimwa9 Zaimwa9 requested review from Zaimwa9 and removed request for kyle-ssg June 23, 2026 10:50

@Zaimwa9 Zaimwa9 left a comment

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.

Thanks for the contribution. We'll need to be more precise to not block free customers to delete their organization

@afsuyadi afsuyadi force-pushed the fix/prevent-deletion-chargebee-subscription branch from 6ae43cd to 2093bbf Compare June 23, 2026 11:51
@afsuyadi afsuyadi requested a review from Zaimwa9 June 23, 2026 12:10
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Jul 2, 2026 12:43pm

Request Review

@Zaimwa9 Zaimwa9 left a comment

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.

One UX improvement that I noticed, sorry for the back and forth

@afsuyadi afsuyadi force-pushed the fix/prevent-deletion-chargebee-subscription branch from ae1ed56 to f6402e0 Compare July 1, 2026 00:54
@afsuyadi afsuyadi requested a review from Zaimwa9 July 1, 2026 02:12

@Zaimwa9 Zaimwa9 left a comment

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.

Thanks for the contribution and the effort!

@Zaimwa9 Zaimwa9 merged commit 44206a2 into Flagsmith:main Jul 2, 2026
21 of 23 checks passed
@afsuyadi afsuyadi deleted the fix/prevent-deletion-chargebee-subscription branch July 3, 2026 00:57
@afsuyadi

afsuyadi commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the contribution and the effort!

No prob. Please do mention me if there is any backend issues that need support 👍

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

Labels

front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants