Skip to content
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

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

cephaschapa
Copy link
Contributor

@cephaschapa cephaschapa commented Mar 3, 2025

Changes

  • Adds confirm registration template
  • Modifies e2e test to accomodate 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.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

@cephaschapa cephaschapa requested a review from lemilonkh March 3, 2025 12:02
Copy link
Contributor

@lemilonkh lemilonkh left a comment

Choose a reason for hiding this comment

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

Great, thanks 👍

Copy link

@korbit-ai korbit-ai bot left a 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
Readability Misleading Variable Name ▹ view
Functionality Missing Email Verification Flow ▹ view
Readability Magic Number in Timeout ▹ view
Functionality Incorrect Grammar in Registration Message ▹ view
Readability Unnecessary Non-null Assertion ▹ view
Readability Unnecessary Imports ▹ view
Suppressed issues based on your team's Korbit activity
This issue Is similar to Because

line 36:

Email sending failure blocks user registration instead of handling it gracefully.

Incorrect Error Handling for Email Failure

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({
Copy link

Choose a reason for hiding this comment

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

Misleading Variable Name category Readability

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({

Report a problem with this comment

💬 Chat with Korbit by mentioning @korbit-ai.

subject: "City Catalyst - User Registration",
html: render(
ConfirmRegistrationTemplate({
url: `${host}/dashboard`,
Copy link

Choose a reason for hiding this comment

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

Missing Email Verification Flow category Functionality

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.

Report a problem with this comment

💬 Chat with Korbit by mentioning @korbit-ai.

Comment on lines +11 to +12
// First set timeout to accommodate send email to finish process
test.setTimeout(60000);
Copy link

Choose a reason for hiding this comment

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

Magic Number in Timeout category Readability

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);

Report a problem with this comment

💬 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 />{" "}
Copy link

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 category Functionality

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.

Report a problem with this comment

💬 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!,
Copy link

Choose a reason for hiding this comment

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

Unnecessary Non-null Assertion category Readability

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,

Report a problem with this comment

💬 Chat with Korbit by mentioning @korbit-ai.

Comment on lines +1 to +4
import { useCopyToClipboard } from "@/hooks/use-copy-to-clipboard";
import { CityAttributes } from "@/models/City";
import { UserAttributes } from "@/models/User";
import React, { useState } from "react";
Copy link

Choose a reason for hiding this comment

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

Unnecessary Imports category Readability

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";

Report a problem with this comment

💬 Chat with Korbit by mentioning @korbit-ai.

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.

2 participants