Repository navigation
Conversation
|
@waterWang is attempting to deploy a commit to the vernu's projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThe profile form now sends email verification requests through ChangesEmail verification
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/app/`(app)/dashboard/(components)/account/edit-profile-form.tsx:
- Around line 47-63: Update the useSendEmailVerification usage in
edit-profile-form.tsx so the hook is called without arguments, and pass the
onSuccess and onError toast callbacks through sendEmailVerification.mutate()
inside handleVerifyEmail. Preserve the existing verification success and failure
behavior.
🪄 Autofix
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c3ccc107-ab88-4a10-92ab-a50826cebb42
📒 Files selected for processing (1)
web/app/(app)/dashboard/(components)/account/edit-profile-form.tsx
| const sendEmailVerification = useSendEmailVerification({ | ||
| onSuccess: () => { | ||
| toast({ | ||
| title: 'Verification email sent!', | ||
| description: 'Check your inbox for the verification link.', | ||
| }) | ||
| }, | ||
| onError: () => { | ||
| toast({ | ||
| title: 'Failed to send verification email', | ||
| variant: 'destructive', | ||
| }) | ||
| }, | ||
| }) | ||
|
|
||
| const handleVerifyEmail = () => { | ||
| // TODO: Implement email verification | ||
| sendEmailVerification.mutate() |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
rg -n -A8 -B2 'export function useSendEmailVerification' web/lib/api/hooks.ts
rg -n -A18 -B2 'useSendEmailVerification\(' web --glob '*.{ts,tsx}'Repository: vernu/textbee
Length of output: 3471
The useSendEmailVerification() hook does not accept parameters.
The hook defined at lines 222-227 in web/lib/api/hooks.ts takes no parameters. Line 47 in edit-profile-form.tsx passes an options object with onSuccess and onError callbacks. This causes a TypeScript compilation error: "Expected 0 arguments, but got 1."
If type checking is bypassed, the callbacks are ignored at runtime and the toasts do not appear.
Pass the callbacks to sendEmailVerification.mutate() on line 63 instead, or update the hook to accept mutation options as a parameter.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/app/`(app)/dashboard/(components)/account/edit-profile-form.tsx around
lines 47 - 63, Update the useSendEmailVerification usage in
edit-profile-form.tsx so the hook is called without arguments, and pass the
onSuccess and onError toast callbacks through sendEmailVerification.mutate()
inside handleVerifyEmail. Preserve the existing verification success and failure
behavior.
Summary
Fixes #282 — The email Verify button on the profile page was a hardcoded disabled no-op with an empty handler.
Changes
useSendEmailVerification()— the existing hook that posts to the resend-verification endpoint is now called when the Verify button is clicked.disabled={true}and replaced it with the mutation pending state.isUpdatingProfile(the unrelated profile-save mutation). Now it correctly reflects the verification email send state.The backend
useSendEmailVerification()hook already existed inweb/lib/api/hooks.ts— it was just never wired to this button.Summary by CodeRabbit