Skip to content

fix: wire email verification button to existing API hook (Fixes #282) - #284

Open
waterWang wants to merge 1 commit into
textbee:mainfrom
waterWang:fix/email-verify-button
Open

waterWang wants to merge 1 commit into
textbee:mainfrom
waterWang:fix/email-verify-button

Conversation

@waterWang

@waterWang waterWang commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #282 — The email Verify button on the profile page was a hardcoded disabled no-op with an empty handler.

Changes

  1. Wired useSendEmailVerification() — the existing hook that posts to the resend-verification endpoint is now called when the Verify button is clicked.
  2. Enabled the button — removed disabled={true} and replaced it with the mutation pending state.
  3. Fixed the spinner — the button spinner was driven by isUpdatingProfile (the unrelated profile-save mutation). Now it correctly reflects the verification email send state.
  4. Added feedback — success/error toasts so the user knows whether the email was sent.

The backend useSendEmailVerification() hook already existed in web/lib/api/hooks.ts — it was just never wired to this button.

Summary by CodeRabbit

  • New Features
    • Added email verification from the profile settings.
    • Added success and error notifications for verification requests.
    • Verification controls now show progress and prevent duplicate submissions while processing.

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

@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.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The profile form now sends email verification requests through useSendEmailVerification. It shows success or error toasts and uses the verification request state for the button loading and disabled states.

Changes

Email verification

Layer / File(s) Summary
Wire email verification request
web/app/(app)/dashboard/(components)/account/edit-profile-form.tsx
The Verify button calls useSendEmailVerification, displays success or error toasts, and uses the mutation pending state for its disabled and loading states.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes wiring the existing email verification hook to the profile button and references issue #282.
Linked Issues check ✅ Passed The changes address all objectives in issue #282: enabling the button, using the correct pending state, invoking the hook, and showing toast feedback.
Out of Scope Changes check ✅ Passed The changes are limited to the profile email verification button and contain no unrelated code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 80bb470 and a839421.

📒 Files selected for processing (1)
  • web/app/(app)/dashboard/(components)/account/edit-profile-form.tsx

Comment on lines +47 to +63
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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 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.

This branch has not been deployed

No deployments
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.

Web: email Verify button on the profile page is a disabled no-op

1 participant