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

fix: send users list in vertical tagging email #4582

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions course_discovery/apps/tagging/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def send_email_for_course_vertical_assignment(course, to_users):
Sends an email to specified users requesting action to assign vertical and sub-vertical
for a given course, but only to those who have email notifications enabled.
"""
email_enabled_users = [user.email for user in to_users if is_email_notification_enabled(user)]
email_enabled_users = [user for user in to_users if is_email_notification_enabled(user)]
if not email_enabled_users:
logger.exception(
f"Failed to send vertical assignment email for course '{course.title}' (UUID: {course.uuid})"
Expand Down Expand Up @@ -70,5 +70,5 @@ def send_email_for_course_vertical_assignment(course, to_users):
except Exception as e: # pylint: disable=broad-except
logger.exception(
f"Failed to send vertical assignment email for course '{course.title}' (UUID: {course.uuid}) to "
f"recipients {', '.join(email_enabled_users)}. Error: {str(e)}"
f"recipients {', '.join(list(map(lambda user: user.email, email_enabled_users)))}. Error: {str(e)}"
)
2 changes: 1 addition & 1 deletion course_discovery/apps/tagging/tests/test_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_email_sent_to_recipients(self):
self.assertEqual(len(mail.outbox), 1)

email = mail.outbox[0]
self.assertEqual(email.to, [self.user1.email, self.user2.email])
self.assertEqual(email.to, [self.user1, self.user2])
expected_subject = f"Action Required: Assign Vertical and Sub-vertical for Course '{self.course.title}'"
self.assertEqual(email.subject, expected_subject)

Expand Down
Loading