-
Notifications
You must be signed in to change notification settings - Fork 4
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/add confirm registration email template #1169
base: develop
Are you sure you want to change the base?
Conversation
…//github.com/Open-Earth-Foundation/CityCatalyst into feat/add-confirm-registration-email-template merge
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.
Great, thanks 👍
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.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Fix Detected |
---|---|---|
Misleading Variable Name ▹ view | ||
Missing Email Verification Flow ▹ view | ||
Magic Number in Timeout ▹ view | ||
Incorrect Grammar in Registration Message ▹ view | ||
Unnecessary Non-null Assertion ▹ view | ||
Unnecessary Imports ▹ view |
Suppressed issues based on your team's Korbit activity
This issue | Is similar to | Because |
---|---|---|
Email sending failure blocks user registration instead of handling it gracefully. |
Ignored |
When you react to issues (for example, an upvote or downvote) or you fix them, Korbit will tune future reviews based on these signals.
Files scanned
File Path | Reviewed |
---|---|
app/e2e/auth.setup.ts | ✅ |
app/src/app/api/v0/auth/register/route.ts | ✅ |
app/src/lib/emails/confirmRegistrationTemplate.tsx | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Need a new review? Comment
/korbit-review
on this PR and I'll review your latest changes.Korbit Guide: Usage and Customization
Interacting with Korbit
- You can manually ask Korbit to review your PR using the
/korbit-review
command in a comment at the root of your PR.- You can ask Korbit to generate a new PR description using the
/korbit-generate-pr-description
command in any comment on your PR.- Too many Korbit comments? I can resolve all my comment threads if you use the
/korbit-resolve
command in any comment on your PR.- Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
- Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.
Customizing Korbit
- Check out our docs on how you can make Korbit work best for you and your team.
- Customize Korbit for your organization through the Korbit Console.
Current Korbit Configuration
General Settings
Setting Value Review Schedule Automatic excluding drafts Max Issue Count 10 Automatic PR Descriptions ✅ Issue Categories
Category Enabled Documentation ✅ Logging ✅ Error Handling ✅ Readability ✅ Design ✅ Performance ✅ Security ✅ Functionality ✅ Feedback and Support
Note
Korbit Pro is free for open source projects 🎉
Looking to add Korbit to your team? Get started with a free 2 week trial here
@@ -27,6 +31,22 @@ export const POST = apiHandler(async (req: Request) => { | |||
await user.addCity(inventory?.cityId); | |||
} | |||
|
|||
// Send email to user | |||
const host = process.env.HOST ?? "http://localhost:3000"; | |||
const sendInvite = await sendEmail({ |
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.
Misleading Variable Name 
Tell me more
What is the issue?
The variable name 'sendInvite' is misleading as it's being used to store the result of sending a registration confirmation email, not an invite.
Why this matters
Using incorrect terminology in variable names can cause confusion and make the code harder to maintain, especially when dealing with different types of emails in the system.
Suggested change ∙ Feature Preview
const emailSent = await sendEmail({
💬 Chat with Korbit by mentioning @korbit-ai.
subject: "City Catalyst - User Registration", | ||
html: render( | ||
ConfirmRegistrationTemplate({ | ||
url: `${host}/dashboard`, |
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.
Missing Email Verification Flow 
Tell me more
What is the issue?
The registration confirmation email sends users to the dashboard instead of an email verification page, which contradicts the stated intent of account activation.
Why this matters
Users will bypass the account activation step, compromising the security enhancement goal mentioned in the developer intent.
Suggested change ∙ Feature Preview
Implement a verification endpoint and update the URL in the email template:
url: `${host}/verify-email/${verificationToken}`
This requires adding a verification token to the user model and creating a verification endpoint.
💬 Chat with Korbit by mentioning @korbit-ai.
// First set timeout to accommodate send email to finish process | ||
test.setTimeout(60000); |
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.
Magic Number in Timeout 
Tell me more
What is the issue?
The magic number 60000 for timeout is not immediately clear what duration it represents.
Why this matters
Future developers will need to mentally convert the milliseconds to understand this is a 60-second timeout, making the code less maintainable.
Suggested change ∙ Feature Preview
const EMAIL_SEND_TIMEOUT_SEC = 60;
test.setTimeout(EMAIL_SEND_TIMEOUT_SEC * 1000);
💬 Chat with Korbit by mentioning @korbit-ai.
<Text style={heading}>Welcome to CityCatalyst</Text> | ||
<Text style={greeting}>Hi {user?.name},</Text> | ||
<Text style={paragraph}> | ||
Thank you for registering an account CityCatalyst. <br /> <br />{" "} |
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.
Incorrect Grammar in Registration Message 
Tell me more
What is the issue?
Missing word 'with' in the registration confirmation message, which makes the sentence grammatically incorrect and unprofessional.
Why this matters
Grammatical errors in official communications can affect the company's professional image and user trust.
Suggested change ∙ Feature Preview
Modify the text to include the missing word:
Thank you for registering an account with CityCatalyst.
💬 Chat with Korbit by mentioning @korbit-ai.
// Send email to user | ||
const host = process.env.HOST ?? "http://localhost:3000"; | ||
const sendInvite = await sendEmail({ | ||
to: body.email!, |
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.
Unnecessary Non-null Assertion 
Tell me more
What is the issue?
Using the non-null assertion operator (!) is less readable than explicit null checks, especially since body.email has already been validated by signupRequest.parse().
Why this matters
Non-null assertions can hide potential runtime errors and make the code harder to understand for developers not familiar with the validation context.
Suggested change ∙ Feature Preview
to: body.email,
💬 Chat with Korbit by mentioning @korbit-ai.
import { useCopyToClipboard } from "@/hooks/use-copy-to-clipboard"; | ||
import { CityAttributes } from "@/models/City"; | ||
import { UserAttributes } from "@/models/User"; | ||
import React, { useState } from "react"; |
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.
Unnecessary Imports 
Tell me more
What is the issue?
Unused imports that are not required for the email template functionality.
Why this matters
Unused imports can lead to larger bundle sizes and potential runtime errors if the imports are removed or modified.
Suggested change ∙ Feature Preview
Remove the unused imports:
import React from "react";
💬 Chat with Korbit by mentioning @korbit-ai.
Changes
Description by Korbit AI
What change is being made?
Add a new email template for registration confirmation, integrate the template with the registration endpoint to send out confirmation emails, and adjust test scripts to accommodate the email sending process with extended timeouts.
Why are these changes being made?
This change is made to improve the onboarding experience by automatically sending a confirmation email to users who register. The new template ensures consistency and brand alignment for our communications. The timeout extensions in test scripts are necessary to account for the email sending operation, ensuring tests do not fail due to network delays.