Add feature flag for team account deletion
Updated the team account settings page to support a new feature flag for enabling team deletion. Only the primary user can delete the account if this feature is enabled. Also, corrected the required error message in feature-flags.config.ts file for more clarity.
This commit is contained in:
@@ -39,12 +39,17 @@ import { leaveTeamAccountAction } from '../../server/actions/leave-team-account-
|
||||
export function TeamAccountDangerZone({
|
||||
account,
|
||||
primaryOwnerUserId,
|
||||
features,
|
||||
}: React.PropsWithChildren<{
|
||||
account: {
|
||||
name: string;
|
||||
id: string;
|
||||
};
|
||||
|
||||
features: {
|
||||
enableTeamDeletion: boolean;
|
||||
};
|
||||
|
||||
primaryOwnerUserId: string;
|
||||
}>) {
|
||||
const { data: user } = useUser();
|
||||
@@ -56,7 +61,7 @@ export function TeamAccountDangerZone({
|
||||
// Only the primary owner can delete the team account
|
||||
const userIsPrimaryOwner = user.id === primaryOwnerUserId;
|
||||
|
||||
if (userIsPrimaryOwner) {
|
||||
if (userIsPrimaryOwner && features.enableTeamDeletion) {
|
||||
return <DeleteTeamContainer account={account} />;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ export function TeamAccountSettingsContainer(props: {
|
||||
paths: {
|
||||
teamAccountSettings: string;
|
||||
};
|
||||
|
||||
features: {
|
||||
enableTeamDeletion: boolean;
|
||||
}
|
||||
}) {
|
||||
return (
|
||||
<div className={'flex w-full flex-col space-y-6'}>
|
||||
@@ -78,6 +82,7 @@ export function TeamAccountSettingsContainer(props: {
|
||||
<TeamAccountDangerZone
|
||||
primaryOwnerUserId={props.account.primaryOwnerUserId}
|
||||
account={props.account}
|
||||
features={props.features}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user