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

feat: account deletion #846

Merged
merged 16 commits into from
Feb 25, 2024
Merged

feat: account deletion #846

merged 16 commits into from
Feb 25, 2024

Conversation

ephraimduncan
Copy link
Collaborator

@ephraimduncan ephraimduncan commented Jan 21, 2024

Summary by CodeRabbit

  • New Features
    • Added two-factor authentication form handling in profile settings.
    • Introduced account deletion functionality, including Stripe customer data removal.
    • Updated UI components and styles for improved user interaction, such as enhanced visual feedback for destructive actions.
  • Refactor
    • Improved code quality by updating import statements for type-only imports.
  • Chores
    • Restructured the forwardPorts array in dev container configuration for clarity.
    • Removed a trailing comma in the vscode extensions list to adhere to JSON format rules.
  • Documentation
    • Added comments to clarify the handling of undefined values in two-factor authentication verification.
  • Database
    • Implemented a SQL migration script for creating a default deleted user in the system.

Copy link
Contributor

coderabbitai bot commented Jan 21, 2024

Important

Auto Review Skipped

Auto reviews are limited to the following labels: coderabbit. Please add one of these labels to enable auto reviews.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

The overall change enhances user interface components, introduces two-factor authentication handling, and adds functionality for account deletion, including Stripe customer data removal. It also optimizes imports by using type-specific imports where applicable. Additionally, a SQL migration script creates a default deleted user entity, and UI elements like buttons receive visual feedback improvements. These updates collectively aim to improve user experience, security, and code maintainability.

Changes

File(s) Summary
.devcontainer/devcontainer.json Restructured forwardPorts and removed trailing comma in vscode extensions list.
apps/web/.../forms/profile.tsx Added UI component imports, form handling for 2FA token, account deletion logic, and updated UI for profile form.
packages/ee/.../stripe/delete-customer.ts Introduced deleteStripeCustomer function for deleting Stripe customer data.
packages/lib/.../2fa/validate-2fa.ts
packages/lib/.../2fa/verify-2fa-token.ts
packages/trpc/react/index.tsx
Updated to use type-specific imports for User and AppRouter. Added a comment about an undefined value in verify-2fa-token.ts.
packages/lib/.../user/delete-user.ts Added check for default delete user and updated documents' association before user deletion.
packages/prisma/.../20240205120648_create_delete_account/migration.sql SQL migration script to create a new default deleted user entity.
packages/trpc/.../auth-router/schema.ts Added ZDeleteAccountMutationSchema for account deletion with email field validation.
packages/trpc/.../profile-router/router.ts Added user account deletion functionality, including Stripe data removal and error handling.
packages/ui/primitives/button.tsx Updated destructive button style for enhanced focus-visible ring effect.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

vercel bot commented Jan 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stg-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2024 11:22am
stg-marketing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2024 11:22am
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
prd-app ⬜️ Ignored (Inspect) Feb 25, 2024 11:22am
prd-marketing ⬜️ Ignored (Inspect) Feb 25, 2024 11:22am

@dguyen dguyen linked an issue Jan 23, 2024 that may be closed by this pull request
@ephraimduncan ephraimduncan self-assigned this Jan 28, 2024
Copy link

github-actions bot commented Feb 5, 2024

🚨 @dephraiim has 4 pull requests awaiting review. Please consider reviewing them when possible. 🚨

@ephraimduncan
Copy link
Collaborator Author

@coderabbitai review

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 5

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c6457e7 and 3075281.
Files selected for processing (11)
  • .devcontainer/devcontainer.json (2 hunks)
  • apps/web/src/components/forms/profile.tsx (5 hunks)
  • packages/ee/server-only/stripe/delete-customer.ts (1 hunks)
  • packages/lib/server-only/2fa/validate-2fa.ts (1 hunks)
  • packages/lib/server-only/2fa/verify-2fa-token.ts (2 hunks)
  • packages/lib/server-only/user/delete-user.ts (1 hunks)
  • packages/prisma/migrations/20240205120648_create_delete_account/migration.sql (1 hunks)
  • packages/trpc/react/index.tsx (1 hunks)
  • packages/trpc/server/auth-router/schema.ts (1 hunks)
  • packages/trpc/server/profile-router/router.ts (2 hunks)
  • packages/ui/primitives/button.tsx (1 hunks)
Additional comments: 2
.devcontainer/devcontainer.json (1)
  • 10-22: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [13-34]

The changes to the forwardPorts array and VSCode extensions list improve readability and consistency.

apps/web/src/components/forms/profile.tsx (1)
  • 116-171: The implementation for account deletion, including handling for two-factor authentication, enhances user experience and security. Ensure that the process is clearly communicated to the user, especially the irreversible nature of account deletion.

packages/ee/server-only/stripe/delete-customer.ts Outdated Show resolved Hide resolved
packages/lib/server-only/2fa/verify-2fa-token.ts Outdated Show resolved Hide resolved
packages/lib/server-only/user/delete-user.ts Outdated Show resolved Hide resolved
packages/trpc/server/profile-router/router.ts Outdated Show resolved Hide resolved
apps/web/src/components/forms/profile.tsx Outdated Show resolved Hide resolved
packages/lib/server-only/2fa/verify-2fa-token.ts Outdated Show resolved Hide resolved
packages/lib/server-only/user/delete-user.ts Outdated Show resolved Hide resolved
Copy link

🚨 @dephraiim has 4 pull requests awaiting review. Please consider reviewing them when possible. 🚨

@Mythie Mythie merged commit df3ba11 into main Feb 25, 2024
13 checks passed
@Mythie Mythie deleted the feat/account-deletion branch February 25, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create an account deletion button
2 participants