Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor onboarding user vars to be absent when user is fully onboarded #6531

Merged
merged 4 commits into from
Aug 4, 2024

Conversation

charlesBochet
Copy link
Member

@charlesBochet charlesBochet commented Aug 4, 2024

In this PR:

I'm retesting the whole flow:

  • with/without BILLING
  • sign in with/without SSO
  • sign up with/without SSO
  • another workspaceMembers join the team
  • subscriptionCanceled
  • access to billingPortal

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Refactored onboarding user variables to be absent when the user is fully onboarded and introduced a new workspace activation status.

  • /packages/twenty-server/src/engine/core-modules/onboarding/onboarding.service.ts: Refactored isStepComplete to isStepIncomplete and simplified subscription checks using BillingService.
  • /packages/twenty-server/src/database/commands/upgrade-version/0-23/0-23-backfill-new-onboarding-user-vars.ts: Simplified logic for fetching workspaces using object spread syntax.
  • /packages/twenty-server/src/engine/core-modules/billing/services/billing.service.ts: Introduced BillingService for managing billing-related functionality.
  • /packages/twenty-server/src/engine/core-modules/billing/services/billing-subscription.service.ts: Enhanced error handling by renaming methods to enforce stricter validation.
  • /packages/twenty-server/src/engine/core-modules/billing/stripe/stripe.service.ts: Refactored formatProductPrices method for improved readability and efficiency.

7 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings

Comment on lines 47 to 48
!isDefined(currentBillingSubscription) ||
currentBillingSubscription?.status === SubscriptionStatus.Incomplete
Copy link

Choose a reason for hiding this comment

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

logic: The logic here seems inverted. Shouldn't it return true if currentBillingSubscription is defined and its status is not Incomplete?

Suggested change
!isDefined(currentBillingSubscription) ||
currentBillingSubscription?.status === SubscriptionStatus.Incomplete
return (
isDefined(currentBillingSubscription) &&
currentBillingSubscription.status !== SubscriptionStatus.Incomplete
);

@@ -24,11 +24,20 @@ export const PrefetchRunQueriesEffect = () => {
prefetchKey: PrefetchKey.AllFavorites,
});

const { objectMetadataItems } = useObjectMetadataItems();
Copy link
Member Author

Choose a reason for hiding this comment

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

refactor PrefetchQueries to make sure that they are leveraging operationSignatures

@charlesBochet charlesBochet merged commit 0320402 into main Aug 4, 2024
5 of 10 checks passed
@charlesBochet charlesBochet deleted the onboarding-user-vars-v2 branch August 4, 2024 18:37
Copy link
Contributor

@martmull martmull left a comment

Choose a reason for hiding this comment

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

small comments, opening a PR to pass them

});
}

async toggleOnboardingCreateProfileCompletion({
async setOnboardingCreateProfileCompletion({
Copy link
Contributor

Choose a reason for hiding this comment

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

setOnboardingCreateProfilePending

value: true,
});

await this.onboardingService.setOnboardingCreateProfileCompletion({
Copy link
Contributor

Choose a reason for hiding this comment

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

should not be called if firstName!=='' && lastName!==''

value: true,
});

await this.onboardingService.setOnboardingCreateProfileCompletion({
Copy link
Contributor

Choose a reason for hiding this comment

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

should not be called if firstName!=='' && lastName!==''

FelixMalfait pushed a commit that referenced this pull request Aug 7, 2024
see comments in
#6531 (review)
- rename method
- add check before setting create profile pending user var
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants