diff --git a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py index eba4348053..aadaf75916 100644 --- a/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py +++ b/openedx/core/djangoapps/schedules/management/commands/tests/test_send_recurring_nudge.py @@ -312,6 +312,8 @@ class TestSendRecurringNudge(FilteredQueryCountMixin, CacheIsolationTestCase): for (_name, (_msg, email), _kwargs) in mock_channel.deliver.mock_calls: for template in attr.astuple(email): self.assertNotIn("TEMPLATE WARNING", template) + self.assertNotIn("{{", template) + self.assertNotIn("}}", template) def test_user_in_course_with_verified_coursemode_receives_upsell(self): user = UserFactory.create() diff --git a/openedx/core/djangoapps/schedules/resolvers.py b/openedx/core/djangoapps/schedules/resolvers.py index be8a938df1..3017868046 100644 --- a/openedx/core/djangoapps/schedules/resolvers.py +++ b/openedx/core/djangoapps/schedules/resolvers.py @@ -344,7 +344,7 @@ class CourseUpdateResolver(BinnedSchedulesBaseResolver): for schedule in schedules: enrollment = schedule.enrollment try: - week_summary = get_course_week_summary(enrollment.course_id, week_num) + week_highlights = get_week_highlights(enrollment.course_id, week_num) except CourseUpdateDoesNotExist: continue @@ -357,7 +357,7 @@ class CourseUpdateResolver(BinnedSchedulesBaseResolver): self.site, reverse('course_root', args=[course_id_str]) ), 'week_num': week_num, - 'week_summary': week_summary, + 'week_highlights': week_highlights, # This is used by the bulk email optout policy 'course_ids': [course_id_str], @@ -368,9 +368,9 @@ class CourseUpdateResolver(BinnedSchedulesBaseResolver): @request_cached -def get_course_week_summary(course_id, week_num): +def get_week_highlights(course_id, week_num): if COURSE_UPDATE_WAFFLE_FLAG.is_enabled(course_id): course = modulestore().get_course(course_id) - return course.week_summary(week_num) + return course.highlights_for_week(week_num) else: raise CourseUpdateDoesNotExist() diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/return_to_course_cta.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/return_to_course_cta.html new file mode 100644 index 0000000000..eb6e6b0c0b --- /dev/null +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/return_to_course_cta.html @@ -0,0 +1,27 @@ +{% load i18n %} + +

+ {# email client support for style sheets is pretty spotty, so we have to inline all of these styles #} + 1 %} + href="{{ dashboard_url }}" + {% else %} + href="{{ course_url }}" + {% endif %} + style=" + color: #ffffff; + text-decoration: none; + border-radius: 4px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + background-color: #005686; + border-top: 12px solid #005686; + border-bottom: 12px solid #005686; + border-right: 50px solid #005686; + border-left: 50px solid #005686; + display: inline-block; + "> + {# old email clients require the use of the font tag :( #} + {{ course_cta_text }} + +

diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/upsell_cta.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/upsell_cta.html new file mode 100644 index 0000000000..b134529583 --- /dev/null +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/upsell_cta.html @@ -0,0 +1,26 @@ +{% load i18n %} + +{% if show_upsell %} +

+ {% blocktrans trimmed %} + Don't miss the opportunity to highlight your new knowledge and skills by earning a verified + certificate. Upgrade by {{ user_schedule_upgrade_deadline_time }}. + {% endblocktrans %} +

+

+ + {% trans "Upgrade Now" %} + +

+{% endif %} diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/upsell_cta.txt b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/upsell_cta.txt new file mode 100644 index 0000000000..7ee06fa86b --- /dev/null +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/common/upsell_cta.txt @@ -0,0 +1,10 @@ +{% load i18n %} + +{% if show_upsell %} +{% blocktrans trimmed %} + Don't miss the opportunity to highlight your new knowledge and skills by earning a verified + certificate. Upgrade by {{ user_schedule_upgrade_deadline_time }}. + + Upgrade Now! <{{ upsell_link }}> +{% endblocktrans %} +{% endif %} diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.html index e04f056cc3..50ec6bb539 100644 --- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.html +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.html @@ -20,31 +20,18 @@

{% blocktrans trimmed %} Here is what you can look forward to learning this week: -

{{ week_summary }}

{% endblocktrans %} +

-

- - - - {% trans "Resume your course now" %} - -

+ {% trans "Resume your course now" as course_cta_text %} + {% include "schedules/edx_ace/common/return_to_course_cta.html" with course_cta_text=course_cta_text%} + + {% include "schedules/edx_ace/common/upsell_cta.html"%} diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.txt b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.txt index 3a3109ae7f..e9451139f0 100644 --- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.txt +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/courseupdate/email/body.txt @@ -7,3 +7,5 @@ Here is what you can look forward to learning this week: {{ week_summary }} {% endblocktrans %} + +{% include "schedules/edx_ace/common/upsell_cta.txt"%} diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.html index 5d103285b4..a4a5eb1342 100644 --- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.html +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.html @@ -35,56 +35,10 @@ {% endif %}

-

- {# email client support for style sheets is pretty spotty, so we have to inline all of these styles #} - 1 %} - href="{{ dashboard_url }}" - {% else %} - href="{{ course_url }}" - {% endif %} - style=" - color: #ffffff; - text-decoration: none; - border-radius: 4px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - background-color: #005686; - border-top: 12px solid #005686; - border-bottom: 12px solid #005686; - border-right: 50px solid #005686; - border-left: 50px solid #005686; - display: inline-block; - "> - {# old email clients require the use of the font tag :( #} - {% trans "Keep learning" %} - -

+ {% trans "Keep learning" as course_cta_text %} + {% include "schedules/edx_ace/common/return_to_course_cta.html" with course_cta_text=course_cta_text%} - {% if show_upsell %} -

- {% blocktrans trimmed %} - Don't miss the opportunity to highlight your new knowledge and skills by earning a verified - certificate. Upgrade by {{ user_schedule_upgrade_deadline_time }}. - {% endblocktrans %} -

-

- - {% trans "Upgrade Now" %} - -

- {% endif %} + {% include "schedules/edx_ace/common/upsell_cta.html"%} diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.txt b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.txt index 96dceea942..f6921804cf 100644 --- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.txt +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day10/email/body.txt @@ -12,11 +12,5 @@ {% endblocktrans %} {% trans "Keep learning" %} <{{course_url}}> {% endif %} -{% if show_upsell %} -{% blocktrans trimmed %} - Don't miss the opportunity to highlight your new knowledge and skills by earning a verified - certificate. Upgrade by {{ user_schedule_upgrade_deadline_time }}. - Upgrade Now! <{{ upsell_link }}> -{% endblocktrans %} -{% endif %} +{% include "schedules/edx_ace/common/upsell_cta.txt"%} diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.html index 40122bb22b..551ba7792b 100644 --- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.html +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.html @@ -35,55 +35,10 @@ {% endif %}

-

- {# email client support for style sheets is pretty spotty, so we have to inline all of these styles #} - 1 %} - href="{{ dashboard_url }}" - {% else %} - href="{{ course_url }}" - {% endif %} - style=" - color: #ffffff; - text-decoration: none; - border-radius: 4px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - background-color: #005686; - border-top: 12px solid #005686; - border-bottom: 12px solid #005686; - border-right: 50px solid #005686; - border-left: 50px solid #005686; - display: inline-block; - "> - {# old email clients require the use of the font tag :( #} - {% trans "Start learning now" %} - -

- {% if show_upsell %} -

- {% blocktrans trimmed %} - Don't miss the opportunity to highlight your new knowledge and skills by earning a verified - certificate. Upgrade by {{ user_schedule_upgrade_deadline_time }}. - {% endblocktrans %} -

-

- - {% trans "Upgrade Now" %} - -

- {% endif %} + {% trans "Start learning now" as course_cta_text %} + {% include "schedules/edx_ace/common/return_to_course_cta.html" with course_cta_text=course_cta_text%} + + {% include "schedules/edx_ace/common/upsell_cta.html"%} diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt index a6704ac851..9a1afec99c 100644 --- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/recurringnudge_day3/email/body.txt @@ -16,11 +16,4 @@ {% trans "Start learning now" %} <{{ course_url }}> {% endif %} -{% if show_upsell %} -{% blocktrans trimmed %} - Don't miss the opportunity to highlight your new knowledge and skills by earning a verified - certificate. Upgrade by {{ user_schedule_upgrade_deadline_time }}. - - Upgrade Now! <{{ upsell_link }}> -{% endblocktrans %} -{% endif %} +{% include "schedules/edx_ace/common/upsell_cta.txt"%} diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html index df23ac1b12..d545d5f24f 100644 --- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html @@ -20,8 +20,6 @@ Upgrade by {{ user_schedule_upgrade_deadline_time }}. {% endblocktrans %} {% endif %} - {% blocktrans trimmed %} - {% endblocktrans %} {% endblock %} {% block content %}