Commit f7badbcc by Clinton Blackburn Committed by Clinton Blackburn

Project coordinators are now cc'd on the publish notification email

parent 7feb2663
......@@ -484,7 +484,6 @@ def send_course_run_published_email(course_run, site):
course_name=course_run.course.title,
run_number=course_key.run
)
to_addresses = [course_team_user.email]
from_address = settings.PUBLISHER_FROM_EMAIL
project_coordinator = course_run.course.project_coordinator
page_path = reverse('publisher:publisher_course_run_detail', kwargs={'pk': course_run.id})
......@@ -509,9 +508,11 @@ def send_course_run_published_email(course_run, site):
template = get_template(html_template)
html_content = template.render(context)
email_msg = EmailMultiAlternatives(
subject, plain_content, from_address, to=to_addresses
)
email_kwargs = {
'cc': [project_coordinator.email] if project_coordinator else [],
}
email_msg = EmailMultiAlternatives(subject, plain_content, from_address, to=[course_team_user.email],
**email_kwargs)
email_msg.attach_alternative(html_content, 'text/html')
email_msg.send()
......
......@@ -4,10 +4,6 @@
<!-- Message Body -->
<p>
{% blocktrans trimmed %}
Dear {{ recipient_name }},
{% endblocktrans %}
<p>
{% blocktrans trimmed %}
The About page for the {{ course_run_number }} course run of {{ course_name }} has been published. No further action is necessary.
{% endblocktrans %}
</p>
......
......@@ -499,10 +499,6 @@ class CourseRunPreviewEmailTests(SiteMixin, TestCase):
class CourseRunPublishedEmailTests(SiteMixin, TestCase):
"""
Tests for course run published email functionality.
"""
def setUp(self):
super(CourseRunPublishedEmailTests, self).setUp()
self.user = UserFactory()
......@@ -511,13 +507,8 @@ class CourseRunPublishedEmailTests(SiteMixin, TestCase):
self.course_run = self.run_state.course_run
self.course = self.course_run.course
# add users in CourseUserRole table
factories.CourseUserRoleFactory(
course=self.course, role=PublisherUserRole.CourseTeam, user=self.user
)
factories.CourseUserRoleFactory(
course=self.course, role=PublisherUserRole.Publisher, user=UserFactory()
)
factories.CourseUserRoleFactory(course=self.course, role=PublisherUserRole.CourseTeam, user=self.user)
factories.CourseUserRoleFactory(course=self.course, role=PublisherUserRole.Publisher, user=UserFactory())
toggle_switch('enable_publisher_email_notifications', True)
......@@ -525,6 +516,9 @@ class CourseRunPublishedEmailTests(SiteMixin, TestCase):
"""
Verify that course published email functionality works fine.
"""
project_coordinator = UserFactory()
factories.CourseUserRoleFactory(course=self.course, role=PublisherUserRole.ProjectCoordinator,
user=project_coordinator)
self.course_run.lms_course_id = 'course-v1:testX+test45+2017T2'
self.course_run.save()
emails.send_course_run_published_email(self.course_run, self.site)
......@@ -534,8 +528,12 @@ class CourseRunPublishedEmailTests(SiteMixin, TestCase):
course_name=self.course_run.course.title,
run_number=course_key.run
)
self.assertEqual(len(mail.outbox), 1)
self.assertEqual([self.course.course_team_admin.email], mail.outbox[0].to)
assert len(mail.outbox) == 1
message = mail.outbox[0]
assert message.to == [self.user.email]
assert message.cc == [project_coordinator.email]
self.assertEqual(str(mail.outbox[0].subject), subject)
body = mail.outbox[0].body.strip()
self.assertIn(self.course_run.preview_url, body)
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-28 12:30-0400\n"
"POT-Creation-Date: 2017-09-28 12:52-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -2674,7 +2674,6 @@ msgstr ""
#: apps/publisher/templates/publisher/email/course_run/mark_as_reviewed.txt
#: apps/publisher/templates/publisher/email/course_run/preview_available.html
#: apps/publisher/templates/publisher/email/course_run/preview_available.txt
#: apps/publisher/templates/publisher/email/course_run/published.html
#: apps/publisher/templates/publisher/email/course_run/published.txt
#: apps/publisher/templates/publisher/email/course_run/published_course_run_editing.html
#: apps/publisher/templates/publisher/email/course_run/published_course_run_editing.txt
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-28 12:30-0400\n"
"POT-Creation-Date: 2017-09-28 12:52-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-28 12:30-0400\n"
"POT-Creation-Date: 2017-09-28 12:52-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -3151,7 +3151,6 @@ msgstr ""
#: apps/publisher/templates/publisher/email/course_run/mark_as_reviewed.txt
#: apps/publisher/templates/publisher/email/course_run/preview_available.html
#: apps/publisher/templates/publisher/email/course_run/preview_available.txt
#: apps/publisher/templates/publisher/email/course_run/published.html
#: apps/publisher/templates/publisher/email/course_run/published.txt
#: apps/publisher/templates/publisher/email/course_run/published_course_run_editing.html
#: apps/publisher/templates/publisher/email/course_run/published_course_run_editing.txt
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-28 12:30-0400\n"
"POT-Creation-Date: 2017-09-28 12:52-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment