Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/routes/(console)/account/updateEmail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
type: 'success'
});
trackEvent(Submit.AccountUpdateEmail);
emailPassword = null;
} catch (error) {
addNotification({
message: error.message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
.forProject(page.params.region, page.params.project)
.users.updateEmailVerification($user.$id, !$user.emailVerification);
await invalidate(Dependencies.USER);

addNotification({
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${
!$user.emailVerification ? 'unverified' : 'verified'
message: `The email${$user.name && ` for ${$user.name}`} ${
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

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

Using $user.name && inside a template literal can yield undefined if name is falsy. Consider using a ternary: ${$user.name ? for ${$user.name} : ''} to avoid inserting “undefined.”

Suggested change
message: `The email${$user.name && ` for ${$user.name}`} ${
message: `The email${$user.name ? ` for ${$user.name}` : ''} ${

Copilot uses AI. Check for mistakes.

Copy link
Member

@DH-555 DH-555 Jul 14, 2025

Choose a reason for hiding this comment

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

It's an empty string by default, so not needed

!$user.emailVerification ? 'is no longer verified' : ' has been verified'
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

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

[nitpick] The leading space on the 'has been verified' branch combined with the preceding template space can result in double spaces. Move spacing outside the conditional or remove the extra leading space for consistency.

Suggested change
!$user.emailVerification ? 'is no longer verified' : ' has been verified'
!$user.emailVerification ? 'is no longer verified' : 'has been verified'

Copilot uses AI. Check for mistakes.

Copy link
Member

Choose a reason for hiding this comment

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

Ooops, small leading space there. I think this is not intentional, right? @Joyal-George-KJ

Copy link
Member

Choose a reason for hiding this comment

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

this can be simplified for readability.

}`,
type: 'success'
});
Expand All @@ -44,9 +45,10 @@
.forProject(page.params.region, page.params.project)
.users.updatePhoneVerification($user.$id, !$user.phoneVerification);
await invalidate(Dependencies.USER);

addNotification({
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${
$user.phoneVerification ? 'unverified' : 'verified'
message: `The phone ${$user[$user.name ? 'name' : 'email'] && `for ${$user[$user.name ? 'name' : 'email']}`}${
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

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

The dynamic property guard here may insert undefined if both name and email are missing. Use a nested ternary to explicitly handle each case, e.g., ${$user.name ? for ${$user.name}: $user.email ? for ${$user.email} : ''}.

Suggested change
message: `The phone ${$user[$user.name ? 'name' : 'email'] && `for ${$user[$user.name ? 'name' : 'email']}`}${
message: `The phone${$user.name ? ` for ${$user.name}` : $user.email ? ` for ${$user.email}` : ''}${

Copilot uses AI. Check for mistakes.

!$user.phoneVerification ? ' is no longer verified' : ' has been verified'
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

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

[nitpick] Similarly here, both branches include a leading space—consider unifying whitespace handling outside the conditional to prevent inconsistent spacing in the final message.

Suggested change
message: `The phone ${$user[$user.name ? 'name' : 'email'] && `for ${$user[$user.name ? 'name' : 'email']}`}${
!$user.phoneVerification ? ' is no longer verified' : ' has been verified'
message: `The phone ${$user[$user.name ? 'name' : 'email'] && `for ${$user[$user.name ? 'name' : 'email']}`} ${
!$user.phoneVerification ? 'is no longer verified' : 'has been verified'

Copilot uses AI. Check for mistakes.

Copy link
Member

Choose a reason for hiding this comment

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

same here.

}`,
type: 'success'
});
Expand Down