Skip to content

Commit

Permalink
fix: send users list in vertical tagging email (#4582)
Browse files Browse the repository at this point in the history
  • Loading branch information
DawoudSheraz authored Feb 24, 2025
1 parent 7ae2b3b commit e0f63ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit e0f63ad

Please sign in to comment.