Repository navigation
User Account deletion - #128
Conversation
- added the proper trpc procedure in the auth router and the appropriate method in the auth service to delete the user, used the delete method of the users service, and since the tables are related by one-to-many relationships and ON DELETE CASCADE, it removes all the user data - installed the shadcn dialog component - added a `DeleteAccountSection` component in the dashboard with a dialog containing a form: the user is asked to enter his email and the confirm text : "delete my account" - fixed the contrast issue of the destructive variant of the button component - reduced the opacity of the placeholder text for the input - when the user confirms his account deletion, we log him out of the dashboard and also from the extension
- fixed the issue of the percentage symbol (%) not being displayed when its value is 0 in the `CustomChartToolTip` component - explicitly added the type "email" for all email inputs in the forms
- bumped extension version to `v0.0.60`
- renamed the `main.tsx` and the `App.tsx` to `router.tsx` and `app.tsx` respectively and moved them in the app folder - updated the path of the router in the `index.html` file of the dashboard - updated the shared eslint rules in the `lint.ts` file of the `eslint-config` package
- bumped turbo to `v2.9.3`
- got the context directly from the `getExtensionContext` function instead of passing it in argument to the following functions: `serveDashboard`, `serveDashboardDev`, `serveDashboardProd`, `deleteToken`, `storeJwtToken`
📝 WalkthroughWalkthroughAdds end-to-end account deletion (UI, API, services), a reusable Dialog component, shifts VS Code extension functions to obtain ExtensionContext internally, updates import paths and small UI/styling tweaks, and bumps extension and tooling versions. Changes
Sequence Diagram(s)mermaid Browser->>Frontend: Open Delete Account dialog & submit (email + phrase) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
apps/dashboard/src/app/pages/profile/profile.tsx (1)
99-112: Consider extracting a reusable section boundary wrapper.This new block repeats the same
ErrorBoundary+FallBackRender+SuspenseBoundarystructure already used multiple times in this file. Extracting a small wrapper component would reduce duplication and keep profile sections easier to maintain.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/dashboard/src/app/pages/profile/profile.tsx` around lines 99 - 112, Extract a small wrapper component (e.g., ProfileSectionBoundary or SectionBoundary) that composes ErrorBoundary, FallBackRender and SuspenseBoundary and accepts children plus props like className, hasCustomSkeleton, and hasCustomChildren; replace the repeated block around DeleteAccountSection (and other similar blocks) with this new wrapper, ensuring you forward the same ErrorBoundary FallbackComponent signature (error, resetErrorBoundary) to FallBackRender and preserve SuspenseBoundary props and children so the behavior of ErrorBoundary, FallBackRender and SuspenseBoundary remains identical.apps/api/src/auth/auth.service.ts (1)
369-372: Remove the return statement fromdeleteAccount—the mutation endpoint doesn't use it.The
deleteAccountmutation in the router (line 207) callsauthService.deleteAccount()without capturing its return value, only clearing the authentication cookie. Returning the deleted user object is unnecessary; the endpoint should returnvoidor a simple success response instead.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/api/src/auth/auth.service.ts` around lines 369 - 372, The deleteAccount method currently returns the deleted user object from usersService.delete; remove the unnecessary return so the method returns void/Promise<void> instead. Update authService.deleteAccount (and its TypeScript signature if present) to call await this.usersService.delete({ id: userId }) without returning the result, ensuring the endpoint that calls deleteAccount still clears the auth cookie and receives no value. Verify any callers assume a return value and adjust types/imports accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/dashboard/src/features/profile/components/delete-account-section.tsx`:
- Line 77: The PUBLISHER constant is using the wrong casing which causes the
vscode deep-link to point to the wrong authority; update the PUBLISHER constant
definition (symbol: PUBLISHER in packages/common/src/constants.ts) from
"friedrich482" to "Friedrich482" so the generated URL (used in
delete-account-section's window.location.href) matches the extension manifest's
"publisher" value and the registered URI handler will be invoked.
- Around line 55-82: Make onSubmit an async function and replace the
callback-style deleteAccountMutation.mutate with await
deleteAccountMutation.mutateAsync(...) so the form's formState.isSubmitting
reliably stays true during the network call; remove the nested logoutMutation
entirely (logoutMutation and its callbacks) since deleteAccount already clears
the auth cookie, and instead after mutateAsync completes await invalidation of
the auth query (trpc.auth.getUser.queryKey) and call navigate("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/login") and the
vscode logout redirect (window.location.href =
`vscode://${PUBLISHER}.${EXTENSION_ID}/logout`) as the single post-success path;
also update the submit button to disable based on
deleteAccountMutation.isPending (or the mutation's pending state) rather than
relying on form.formState.isSubmitting.
In `@packages/ui/src/components/ui/dialog.tsx`:
- Line 42: Update the Tailwind attribute selectors used for Radix Dialog states:
replace occurrences of the custom variants like "data-open:animate-in
data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0" in the
Dialog component's overlay/panel className strings with Radix-compatible
selectors "data-[state=open]:animate-in data-[state=open]:fade-in-0
data-[state=closed]:animate-out data-[state=closed]:fade-out-0"; apply the same
pattern to all similar usages found in sheet.tsx, popover.tsx, and
dropdown-menu.tsx so the animations use Radix's data-state attributes.
---
Nitpick comments:
In `@apps/api/src/auth/auth.service.ts`:
- Around line 369-372: The deleteAccount method currently returns the deleted
user object from usersService.delete; remove the unnecessary return so the
method returns void/Promise<void> instead. Update authService.deleteAccount (and
its TypeScript signature if present) to call await this.usersService.delete({
id: userId }) without returning the result, ensuring the endpoint that calls
deleteAccount still clears the auth cookie and receives no value. Verify any
callers assume a return value and adjust types/imports accordingly.
In `@apps/dashboard/src/app/pages/profile/profile.tsx`:
- Around line 99-112: Extract a small wrapper component (e.g.,
ProfileSectionBoundary or SectionBoundary) that composes ErrorBoundary,
FallBackRender and SuspenseBoundary and accepts children plus props like
className, hasCustomSkeleton, and hasCustomChildren; replace the repeated block
around DeleteAccountSection (and other similar blocks) with this new wrapper,
ensuring you forward the same ErrorBoundary FallbackComponent signature (error,
resetErrorBoundary) to FallBackRender and preserve SuspenseBoundary props and
children so the behavior of ErrorBoundary, FallBackRender and SuspenseBoundary
remains identical.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1a2106a9-0db9-4e93-8866-f862c46b53dc
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (32)
apps/api/src/auth/auth.dto.tsapps/api/src/auth/auth.router.tsapps/api/src/auth/auth.service.tsapps/api/src/extension/extension.router.tsapps/api/src/extension/extension.service.tsapps/api/src/users/users.dto.tsapps/api/src/users/users.service.tsapps/dashboard/eslint.config.tsapps/dashboard/index.htmlapps/dashboard/src/app/app.tsxapps/dashboard/src/app/pages/profile/profile.tsxapps/dashboard/src/app/router.tsxapps/dashboard/src/components/common/custom-chart-tooltip.tsxapps/dashboard/src/components/layout/navigation-reset-wrapper.tsxapps/dashboard/src/features/auth/components/forgot-password-form.tsxapps/dashboard/src/features/auth/components/login-form.tsxapps/dashboard/src/features/auth/components/register-form.tsxapps/dashboard/src/features/profile/components/create-email-update-form.tsxapps/dashboard/src/features/profile/components/delete-account-section.tsxapps/vscode-extension/package.jsonapps/vscode-extension/src/extension.tsapps/vscode-extension/src/utils/auth/delete-token.tsapps/vscode-extension/src/utils/auth/register-auth-uri-handler.tsapps/vscode-extension/src/utils/auth/store-jwt-token.tsapps/vscode-extension/src/utils/dashboard/serve-dashboard/serve-dashboard-dev.tsapps/vscode-extension/src/utils/dashboard/serve-dashboard/serve-dashboard-prod.tsapps/vscode-extension/src/utils/dashboard/serve-dashboard/serve-dashboard.tspackage.jsonpackages/eslint-config/lint.tspackages/ui/src/components/ui/button.tsxpackages/ui/src/components/ui/dialog.tsxpackages/ui/src/components/ui/input.tsx
- capitalized the publisher constant - since the callbackUri of the login function in the vscode-extension will always have the publisher name in lowercase, updated the `VSCodeCallbackUrlSchema` to support the publisher name in lowercase - updated the return url in the `DeleteAccountSection` component to use the publisher name in lowercase
- fixed the broken transitions on the dialog (when it opens/closes)
- replaced all instances of `data-open` with `data-[state=open]` and `data-closed` with `data-[state=closed]` across the `DropdownMenu`, `Popover`, `Sheet` and `Sidebar` components
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/ui/src/components/ui/dialog.tsx`:
- Around line 144-146: The Tailwind selectors used in the cn call for className
(the tokens "*:[a]:hover:text-foreground", "*:[a]:underline",
"*:[a]:underline-offset-3") are invalid; replace them with Tailwind v4 arbitrary
selector variants that target descendant anchors (e.g., use the "[&_a]:..."
form) or direct-child anchors ("[&>a]:...") so the hover, underline and
underline-offset styles apply to anchor elements; update the className string
passed to cn accordingly while keeping the existing "text-muted-foreground" and
"text-sm" tokens.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: bc421b7a-5f98-4c93-8aff-a97368da1087
📒 Files selected for processing (5)
packages/ui/src/components/ui/dialog.tsxpackages/ui/src/components/ui/dropdown-menu.tsxpackages/ui/src/components/ui/popover.tsxpackages/ui/src/components/ui/sheet.tsxpackages/ui/src/components/ui/sidebar.tsx
Commits
feat: delete account
DeleteAccountSectioncomponent in the dashboard with a dialog containing a form: the user is asked to enter his email and the confirm text : "delete my account"fix: custom-tooltip
CustomChartToolTipcomponentchore: extension
v0.0.60refactor: dashboard
main.tsxand theApp.tsxtorouter.tsxandapp.tsxrespectively and moved them in the app folderindex.htmlfile of the dashboardlint.tsfile of theeslint-configpackagebuild: turborepo
v2.9.3refactor: vscode extension context
getExtensionContextfunction instead of passing it in argument to the following functions:serveDashboard,serveDashboardDev,serveDashboardProd,deleteToken,storeJwtTokenSummary by CodeRabbit
New Features
Improvements
Chores