fix: added course_id in email sent event (#35422)

This commit is contained in:
Muhammad Adeel Tajamul
2024-09-05 03:01:43 -07:00
committed by GitHub
parent 2c705c961a
commit f8bf592483
4 changed files with 6 additions and 1 deletions

View File

@@ -41,7 +41,9 @@ def ace_email_sent_handler(sender, **kwargs):
except user_model.DoesNotExist:
user_id = None
course_email = message.context.get('course_email', None)
course_id = course_email.course_id if course_email else None
course_id = message.context.get('course_id')
if not course_id:
course_id = course_email.course_id if course_email else None
tracker.emit(
'edx.bulk_email.sent',
{

View File

@@ -75,6 +75,7 @@ def send_ace_message(goal):
'email': user.email,
'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'course_name': course_name,
'course_id': str(goal.course_key),
'days_per_week': goal.days_per_week,
'course_url': course_home_url,
'goals_unsubscribe_url': goals_unsubscribe_url,

View File

@@ -526,6 +526,7 @@ class CourseNextSectionUpdate(PrefixedDebugLoggerMixin, RecipientResolver):
'week_num': week_num,
'week_highlights': week_highlights,
# This is used by the bulk email optout policy
'course_id': str(course.id),
'course_ids': [str(course.id)],
'unsubscribe_url': unsubscribe_url,
})

View File

@@ -293,6 +293,7 @@ class TestCourseNextSectionUpdateResolver(SchedulesResolverTestMixin, ModuleStor
'contact_email': 'info@example.com',
'contact_mailing_address': '123 Sesame Street',
'course_ids': [str(self.course.id)],
'course_id': str(self.course.id),
'course_name': self.course.display_name,
'course_url': f'http://learning-mfe/course/{self.course.id}/home',
'dashboard_url': '/dashboard',