Skip to content

Commit 00ba3d7

Browse files
committed
Fixes for duplicate activation emails sent
1 parent 68b47c2 commit 00ba3d7

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

src/api/user/user.service.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,35 +1064,6 @@ export class UserService {
10641064
this.logger.log(
10651065
`Published 'event.user.created' notification for ${newUser.user_id.toNumber()}. Attributes: ${JSON.stringify(createdEventAttributes, null, 2)}`,
10661066
);
1067-
1068-
// For activation email, use postDirectBusMessage to match legacy Java structure
1069-
const domain =
1070-
this.configService.get<string>('APP_DOMAIN') || 'topcoder-dev.com'; // Get domain from config
1071-
const fromEmail = `Topcoder <noreply@${domain}>`;
1072-
const sendgridTemplateId = this.configService.get<string>(
1073-
'SENDGRID_RESEND_ACTIVATION_EMAIL_TEMPLATE_ID',
1074-
);
1075-
1076-
if (!sendgridTemplateId) {
1077-
this.logger.error(
1078-
`SendGrid template ID not configured (SENDGRID_RESEND_ACTIVATION_EMAIL_TEMPLATE_ID). Cannot send initial registration/activation email.`,
1079-
);
1080-
} else {
1081-
const activationEmailPayload = {
1082-
data: { handle: newUser.handle, code: otpForActivation },
1083-
from: { email: fromEmail },
1084-
version: 'v3',
1085-
sendgrid_template_id: sendgridTemplateId,
1086-
recipients: [userParams.email], // The original email used for registration
1087-
};
1088-
await this.eventService.postDirectBusMessage(
1089-
'external.action.email',
1090-
activationEmailPayload,
1091-
);
1092-
this.logger.log(
1093-
`Published 'external.action.email' (activation) for ${newUser.user_id.toNumber()} to ${userParams.email}. Payload: ${JSON.stringify(activationEmailPayload, null, 2)}`,
1094-
);
1095-
}
10961067
} catch (eventError) {
10971068
this.logger.error(
10981069
`Failed to publish events for user ${newUser.user_id.toNumber()}: ${eventError.message}`,

0 commit comments

Comments
 (0)