FlowFuse / flowfuse

Build bespoke, flexible, and resilient manufacturing low-code applications with FlowFuse and Node-RED
https://flowfuse.com
Other
265 stars 63 forks source link

Delete Account with Team Deletion #4292

Open joepavitt opened 1 month ago

joepavitt commented 1 month ago

Description

When deleting an account, users need to delete their team first. Whilst prompted, the settings for this are in a different place and not intuitive path to go between these locations.

If I am the only member of a team, that team has no instances, and I choose to delete my account - it should deleted both my account and my team in one hit.

Which customers would this be available to

None

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

cstns commented 1 month ago

@joepavitt, if the user trying to delete the team is the only owner but the team has other members, should we proceed with the team deletion?

joepavitt commented 1 month ago

Good question - @knolleary - thoughts? I'd probably go with "no", as they're the kind of teams we want reaching out to us so that we can understand why they're churned

knolleary commented 1 month ago

I'd stick with only deleting if they are the last person in the team.

cstns commented 1 month ago

OK, sound's good!

Should I also check for device presence?

cstns commented 1 month ago

Looking at the current implementation, we're iterating over the teams the user is a single owner of.

Let's say the user deleting his account is the owner of multiple teams and we try to delete them all. We don't encounter any problems with the first team, but for the 2'nd lets say we find out that it still has an instance assigned and throw an error.

Is the beforeDestroy hook in the modal transactional? We might find ourselves in situations where we delete just a single team then prompt the user with an error and he'll find himself in with a missing team in the case the hook isn't transactional.

Should we consider these scenarios?

joepavitt commented 1 month ago

@cstns two options:

The first option is the "proper" way imo

knolleary commented 1 day ago

I'm reverting the PR that fixes this as it introduced a bug that left teams orphaned with active stripe subscriptions. I'm out of time to fix today, so reverting to prevent it happening further over the weekend. Will rework the original PR on Monday.