fix: prevent billingPortal creation if no active subscription (#9701)
Billing portal is created in settings/billing page even if subscription is canceled, causing server internal error. -> Skip back end request Bonus : display settings/billing page with disabled button even if subscription is canceled --------- Co-authored-by: etiennejouan <jouan.etienne@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -160,6 +160,10 @@ export const queries = {
|
||||
status
|
||||
interval
|
||||
}
|
||||
billingSubscriptions {
|
||||
id
|
||||
status
|
||||
}
|
||||
workspaceMembersCount
|
||||
}
|
||||
workspaces {
|
||||
@ -300,6 +304,8 @@ export const responseData = {
|
||||
currentBillingSubscription: null,
|
||||
workspaceMembersCount: 1,
|
||||
},
|
||||
currentBillingSubscription: null,
|
||||
billingSubscriptions: [],
|
||||
workspaces: [],
|
||||
userVars: null,
|
||||
},
|
||||
|
||||
@ -4,7 +4,11 @@ import { Nullable } from 'twenty-ui';
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { useColumnDefinitionsFromFieldMetadata } from '@/object-metadata/hooks/useColumnDefinitionsFromFieldMetadata';
|
||||
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { WorkspaceActivationStatus } from '~/generated/graphql';
|
||||
import {
|
||||
SubscriptionInterval,
|
||||
SubscriptionStatus,
|
||||
WorkspaceActivationStatus,
|
||||
} from '~/generated/graphql';
|
||||
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
|
||||
import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems';
|
||||
|
||||
@ -23,6 +27,17 @@ const Wrapper = getJestMetadataAndApolloMocksWrapper({
|
||||
isGoogleAuthEnabled: true,
|
||||
isMicrosoftAuthEnabled: false,
|
||||
isPasswordAuthEnabled: true,
|
||||
currentBillingSubscription: {
|
||||
id: '1',
|
||||
interval: SubscriptionInterval.Month,
|
||||
status: SubscriptionStatus.Active,
|
||||
},
|
||||
billingSubscriptions: [
|
||||
{
|
||||
id: '1',
|
||||
status: SubscriptionStatus.Active,
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user