Merge pull request #15161 from open-craft/uman/OC-2663
ENT-392 Refactoring
This commit is contained in:
@@ -94,6 +94,7 @@ from lms.envs.common import (
|
||||
HELP_TOKENS_BOOKS,
|
||||
|
||||
SUPPORT_SITE_LINK,
|
||||
ACTIVATION_EMAIL_SUPPORT_LINK,
|
||||
|
||||
CONTACT_EMAIL,
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ from uuid import uuid4
|
||||
from edxmako.shortcuts import render_to_string
|
||||
from student.models import Registration
|
||||
from student.tests.factories import UserFactory
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
|
||||
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
@@ -31,6 +32,11 @@ class TestActivateAccount(TestCase):
|
||||
self.registration.register(self.user)
|
||||
self.registration.save()
|
||||
|
||||
self.platform_name = configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
|
||||
self.activation_email_support_link = configuration_helpers.get_value(
|
||||
'ACTIVATION_EMAIL_SUPPORT_LINK', settings.SUPPORT_SITE_LINK # Intentional default.
|
||||
)
|
||||
|
||||
def login(self):
|
||||
"""
|
||||
Login with test user.
|
||||
@@ -118,7 +124,11 @@ class TestActivateAccount(TestCase):
|
||||
self.login()
|
||||
expected_message = render_to_string(
|
||||
'registration/account_activation_sidebar_notice.html',
|
||||
{'email': self.user.email}
|
||||
{
|
||||
'email': self.user.email,
|
||||
'platform_name': self.platform_name,
|
||||
'activation_email_support_link': self.activation_email_support_link
|
||||
}
|
||||
)
|
||||
|
||||
response = self.client.get(reverse('dashboard'))
|
||||
@@ -130,7 +140,11 @@ class TestActivateAccount(TestCase):
|
||||
self.login()
|
||||
expected_message = render_to_string(
|
||||
'registration/account_activation_sidebar_notice.html',
|
||||
{'email': self.user.email}
|
||||
{
|
||||
'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)
|
||||
|
||||
@@ -657,6 +657,9 @@ def dashboard(request):
|
||||
'DISPLAY_COURSE_MODES_ON_DASHBOARD',
|
||||
settings.FEATURES.get('DISPLAY_COURSE_MODES_ON_DASHBOARD', True)
|
||||
)
|
||||
activation_email_support_link = configuration_helpers.get_value(
|
||||
'ACTIVATION_EMAIL_SUPPORT_LINK', settings.SUPPORT_SITE_LINK
|
||||
)
|
||||
|
||||
# Let's filter out any courses in an "org" that has been declared to be
|
||||
# in a configuration
|
||||
@@ -712,12 +715,16 @@ def dashboard(request):
|
||||
if display_account_activation_message_on_sidebar and not user.is_active:
|
||||
sidebar_account_activation_message = render_to_string(
|
||||
'registration/account_activation_sidebar_notice.html',
|
||||
{'email': user.email}
|
||||
{
|
||||
'email': user.email,
|
||||
'platform_name': platform_name,
|
||||
'activation_email_support_link': activation_email_support_link
|
||||
}
|
||||
)
|
||||
elif not user.is_active:
|
||||
banner_account_activation_message = render_to_string(
|
||||
'registration/activate_account_notice.html',
|
||||
{'email': user.email, 'platform_name': platform_name}
|
||||
{'email': user.email}
|
||||
)
|
||||
|
||||
enterprise_message = get_dashboard_consent_notification(request, user, course_enrollments)
|
||||
@@ -727,11 +734,11 @@ def dashboard(request):
|
||||
message for message in messages.get_messages(request) if 'account-activation' in message.tags
|
||||
]
|
||||
|
||||
# Global staff can see what courses errored on their dashboard
|
||||
# Global staff can see what courses encountered an error on their dashboard
|
||||
staff_access = False
|
||||
errored_courses = {}
|
||||
if has_access(user, 'staff', 'global'):
|
||||
# Show any courses that errored on load
|
||||
# Show any courses that encountered an error on load
|
||||
staff_access = True
|
||||
errored_courses = modulestore().get_errored_courses()
|
||||
|
||||
|
||||
@@ -310,6 +310,9 @@ ENABLE_COMPREHENSIVE_THEMING = ENV_TOKENS.get('ENABLE_COMPREHENSIVE_THEMING', EN
|
||||
MKTG_URL_LINK_MAP.update(ENV_TOKENS.get('MKTG_URL_LINK_MAP', {}))
|
||||
|
||||
SUPPORT_SITE_LINK = ENV_TOKENS.get('SUPPORT_SITE_LINK', SUPPORT_SITE_LINK)
|
||||
ACTIVATION_EMAIL_SUPPORT_LINK = ENV_TOKENS.get(
|
||||
'ACTIVATION_EMAIL_SUPPORT_LINK', SUPPORT_SITE_LINK # Intentional default.
|
||||
)
|
||||
|
||||
# Mobile store URL overrides
|
||||
MOBILE_STORE_URLS = ENV_TOKENS.get('MOBILE_STORE_URLS', MOBILE_STORE_URLS)
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
"SITE_NAME": "localhost:8003",
|
||||
"STATIC_URL_BASE": "/static/",
|
||||
"SUPPORT_SITE_LINK": "https://support.example.com",
|
||||
"ACTIVATION_EMAIL_SUPPORT_LINK": "https://support.example.com/activation-email-help.html",
|
||||
"SYSLOG_SERVER": "",
|
||||
"TECH_SUPPORT_EMAIL": "technical@example.com",
|
||||
"THIRD_PARTY_AUTH_BACKENDS": [
|
||||
|
||||
@@ -2268,6 +2268,7 @@ MKTG_URL_LINK_MAP = {
|
||||
STATIC_TEMPLATE_VIEW_DEFAULT_FILE_EXTENSION = 'html'
|
||||
|
||||
SUPPORT_SITE_LINK = ''
|
||||
ACTIVATION_EMAIL_SUPPORT_LINK = ''
|
||||
|
||||
############################# SOCIAL MEDIA SHARING #############################
|
||||
# Social Media Sharing on Student Dashboard
|
||||
|
||||
@@ -361,6 +361,7 @@ MKTG_URL_LINK_MAP = {
|
||||
}
|
||||
|
||||
SUPPORT_SITE_LINK = 'https://support.example.com'
|
||||
ACTIVATION_EMAIL_SUPPORT_LINK = 'https://support.example.com/activation-email-help.html'
|
||||
|
||||
############################ STATIC FILES #############################
|
||||
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<%page expression_filter="h"/>
|
||||
<%!
|
||||
from django.utils.translation import ugettext as _
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
%>
|
||||
<div class="profile-sidebar" role="region" aria-labelledby="account-activation-title">
|
||||
@@ -20,11 +19,12 @@ from openedx.core.djangolib.markup import HTML, 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}."
|
||||
)).format(
|
||||
platform_name=platform_name,
|
||||
email_start=HTML("<strong>"),
|
||||
email_end=HTML("</strong>"),
|
||||
email=email,
|
||||
platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
|
||||
link_start=HTML("<a target='_blank' href='https://support.edx.org/hc/en-us/articles/227340127-Why-haven-t-I-received-my-activation-email-'>"),
|
||||
activation_email_support_link=activation_email_support_link,
|
||||
link_start=HTML("<a target='_blank' href='${activation_email_support_link}'>"),
|
||||
link_end=HTML("</a>"),
|
||||
)}
|
||||
</p>
|
||||
|
||||
@@ -16,7 +16,8 @@ from openedx.core.djangolib.markup import HTML, Text
|
||||
"instructions for activating your account. If "
|
||||
"you don't receive this message, check your "
|
||||
"spam folder."
|
||||
)).format(email_start=HTML("<strong>"),
|
||||
)).format(
|
||||
email_start=HTML("<strong>"),
|
||||
email_end=HTML("</strong>"),
|
||||
email=email,
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user