-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Partner invitation email locking #2759
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds URL-based email prefill for partner registration by parsing an email query parameter and locking the email input when valid. Updates partner-invite email template to append a URL-encoded email to the register link. Removes a re-export of a sibling layout file. No public API signature changes. Changes
Sequence Diagram(s)sequenceDiagram
participant Invite as Partner Invite Email
participant User as User (clicks link)
participant Web as Web App (register page)
participant Validator as emailSchema
Invite->>User: Send link /{program.slug}/register?email=<encoded>
User->>Web: Open register URL with email query param
Web->>Validator: safeParse(query.email)
Validator-->>Web: valid / invalid
Web-->>User: Prefill email and set lockEmail if valid
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/email/src/templates/partner-invite.tsx (1)
64-71: URL-encoding looks correct; consider appending the query param only when email is present.Using encodeURIComponent(email) prevents issues with plus tags and special characters in emails. As a minor hardening, append ?email= only if email is truthy to avoid emitting a trailing empty param in edge cases.
Apply this small tweak:
- href={`https://partners.dub.co/${program.slug}/register?email=${encodeURIComponent(email)}`} + href={`https://partners.dub.co/${program.slug}/register${email ? `?email=${encodeURIComponent(email)}` : ""}`}apps/web/app/(ee)/partners.dub.co/(auth)/register/page-client.tsx (1)
33-39: Make lockEmail depend on the email actually being used (optional clarity/UX improvement).Today lockEmail becomes true whenever a valid email is present in the query, even if the prop email (when provided) takes precedence and is different from the query. If you only want to lock when the prefilled email comes from the query, derive both prefilledEmail and resolvedLockEmail first, then pass them to RegisterProvider. This also improves readability.
First, define the derived values:
const searchParams = useSearchParams(); const searchEmailResult = emailSchema.safeParse(searchParams.get("email")); + const queryEmail = + searchEmailResult.success ? searchEmailResult.data : undefined; + const prefilledEmail = email ?? queryEmail; + const resolvedLockEmail = + Boolean(lockEmail) || (!!queryEmail && prefilledEmail === queryEmail);Then, pass them through:
- <RegisterProvider - email={ - email || - (searchEmailResult.success ? searchEmailResult.data : undefined) - } - lockEmail={lockEmail || searchEmailResult.success} - > + <RegisterProvider + email={prefilledEmail} + lockEmail={resolvedLockEmail} + >
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
apps/web/app/(ee)/partners.dub.co/(auth)/register/page-client.tsx(3 hunks)packages/email/src/templates/partner-invite.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (1)
apps/web/app/(ee)/partners.dub.co/(auth)/register/page-client.tsx (1)
29-31: Good use of zod + useSearchParams for safe parsing.Validating the query param with emailSchema.safeParse is robust and avoids trusting raw URL input. This is a solid pattern.
|
@coderabbitai final review please |
🧩 Analysis chainI'll conduct a final review of your partner invitation email locking implementation. Let me examine the code changes in detail. 🏁 Script executed: Length of output: 6318 🏁 Script executed: Length of output: 2185 🏁 Script executed: Length of output: 784 🏁 Script executed: Length of output: 5024 🏁 Script executed: Length of output: 2546 @TWilson023 Excellent implementation! I've reviewed the partner invitation email locking feature and it looks solid. Here's my assessment: ✅ What's Working WellClean Architecture: The changes are minimal and focused, only touching the necessary files with surgical precision. Robust Email Handling:
Security & Encoding:
User Experience:
Code QualityThe implementation follows React/Next.js best practices:
Testing Scenarios CoveredThe implementation handles:
This is a well-crafted feature that enhances the partner invitation flow while maintaining backward compatibility. Great work! ✅ Actions performedComments resolved. |
Summary by CodeRabbit