diff --git a/common/djangoapps/student/tests/test_activate_account.py b/common/djangoapps/student/tests/test_activate_account.py index 62430bf432468c67b963480851e966dd935aec8a..e32f6c78b4e3b5bbe6455ae081b3f2c0b22eab5c 100644 --- a/common/djangoapps/student/tests/test_activate_account.py +++ b/common/djangoapps/student/tests/test_activate_account.py @@ -121,32 +121,29 @@ class TestActivateAccount(TestCase): """ # Log in with test user. self.login() - expected_message = render_to_string( - 'registration/account_activation_sidebar_notice.html', - { - 'email': self.user.email, - 'platform_name': self.platform_name, - 'activation_email_support_link': self.activation_email_support_link - } + expected_message = ( + u"Check your {email_start}{email}{email_end} inbox for an account activation link from " + u"{platform_name}. If you need help, contact {link_start}{platform_name} Support{link_end}." + ).format( + platform_name=self.platform_name, + email_start="<strong>", + email_end="</strong>", + email=self.user.email, + link_start="<a target='_blank' href='{activation_email_support_link}'>".format( + activation_email_support_link=self.activation_email_support_link, + ), + link_end="</a>", ) response = self.client.get(reverse('dashboard')) - self.assertContains(response, expected_message, html=True) + self.assertContains(response, expected_message) # Now make sure account activation message goes away when user activated the account self.user.is_active = True self.user.save() self.login() - expected_message = render_to_string( - 'registration/account_activation_sidebar_notice.html', - { - 'email': self.user.email, - 'platform_name': self.platform_name, - 'activation_email_support_link': self.activation_email_support_link - } - ) response = self.client.get(reverse('dashboard')) - self.assertNotContains(response, expected_message, html=True) + self.assertNotContains(response, expected_message) def test_account_activation_notification_on_logistration(self): """ diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index 2e41f2fc6d78a3aed46abfba7d8470ad60935951..9bdefe56ebd7d16c09d764e526edbf8a4a8e1288 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -611,17 +611,17 @@ def student_dashboard(request): activate_account_message = '' if not user.is_active: activate_account_message = Text(_( - "Check your {email_start}{email}{email_end} inbox for an account activation link from {platform_name}. " - "If you need help, contact {link_start}{platform_name} Support{link_end}." + "Check your {email_start}{email}{email_end} inbox for an account activation link from {platform_name}. " + "If you need help, contact {link_start}{platform_name} Support{link_end}." )).format( - platform_name=platform_name, - email_start=HTML("<strong>"), - email_end=HTML("</strong>"), - email=user.email, - link_start=HTML("<a target='_blank' href='{activation_email_support_link}'>").format( - activation_email_support_link=activation_email_support_link, - ), - link_end=HTML("</a>"), + platform_name=platform_name, + email_start=HTML("<strong>"), + email_end=HTML("</strong>"), + email=user.email, + link_start=HTML("<a target='_blank' href='{activation_email_support_link}'>").format( + activation_email_support_link=activation_email_support_link, + ), + link_end=HTML("</a>"), ) enterprise_message = get_dashboard_consent_notification(request, user, course_enrollments) @@ -819,7 +819,7 @@ def student_dashboard(request): 'disable_courseware_js': True, 'display_course_modes_on_dashboard': enable_verified_certificates and display_course_modes_on_dashboard, 'display_sidebar_on_dashboard': display_sidebar_on_dashboard, - 'display_sidebar_account_activation_message': (not user.is_active and not hide_dashboard_courses_until_activated), + 'display_sidebar_account_activation_message': not(user.is_active or hide_dashboard_courses_until_activated), 'display_dashboard_courses': (user.is_active or not hide_dashboard_courses_until_activated), 'empty_dashboard_message': empty_dashboard_message, }