Skip to content

feat(PM-1613): Send notification to copilot who are accepted #846

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

Merged
merged 2 commits into from
Aug 10, 2025

Conversation

hentrymartin
Copy link
Collaborator

What's in this PR?

  • Send notification to copilot who are accepted

Ticket link - https://topcoder.atlassian.net/browse/PM-1613

@@ -203,6 +203,30 @@ module.exports = [
transaction: t,
});

const sendEmailToCopilot = async () => {
const memberDetails = await util.getMemberDetailsByUserIds([application.userId], req.log, req.id);
const member = memberDetails[0];

Choose a reason for hiding this comment

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

Consider adding error handling for the getMemberDetailsByUserIds function to manage cases where the member details cannot be retrieved.

const emailEventType = CONNECT_NOTIFICATION_EVENT.EXTERNAL_ACTION_EMAIL;
const copilotPortalUrl = config.get('copilotPortalUrl');
const requestData = copilotRequest.data;
createEvent(emailEventType, {

Choose a reason for hiding this comment

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

Ensure that createEvent handles errors gracefully, especially if the email sending fails. Consider adding a try-catch block around this call.

user_name: member ? member.handle : "",
},
sendgrid_template_id: TEMPLATE_IDS.COPILOT_APPLICATION_ACCEPTED,
recipients: [member.email],

Choose a reason for hiding this comment

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

Check if member.email is defined before using it in the recipients array to prevent potential runtime errors.

@hentrymartin hentrymartin merged commit 82c1908 into develop Aug 10, 2025
2 checks passed
@hentrymartin hentrymartin deleted the pm-1613 branch August 10, 2025 20:02
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.

1 participant