Merge pull request #22885 from edx/aehsan/fetch_lms_root_url_from_configuration
fetch lms root url using configuration helper
This commit is contained in:
@@ -16,6 +16,7 @@ from django.conf import settings
|
||||
from django.urls import reverse
|
||||
|
||||
from lms.djangoapps.discussion.notification_prefs.views import UsernameCipher
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
|
||||
|
||||
def get_emails_enabled(user, course_id):
|
||||
@@ -42,7 +43,8 @@ def get_unsubscribed_link(username, course_id):
|
||||
:param course_id:
|
||||
:return: AES encrypted token based on the user email
|
||||
"""
|
||||
lms_root_url = configuration_helpers.get_value('LMS_ROOT_URL', settings.LMS_ROOT_URL)
|
||||
token = UsernameCipher.encrypt(username)
|
||||
optout_url = reverse('bulk_email_opt_out', kwargs={'token': token, 'course_id': course_id})
|
||||
url = '{base_url}{optout_url}'.format(base_url=settings.LMS_ROOT_URL, optout_url=optout_url)
|
||||
url = '{base_url}{optout_url}'.format(base_url=lms_root_url, optout_url=optout_url)
|
||||
return url
|
||||
|
||||
@@ -112,6 +112,7 @@ def _get_course_email_context(course):
|
||||
course_root
|
||||
)
|
||||
image_url = u'{}{}'.format(settings.LMS_ROOT_URL, course_image_url(course))
|
||||
lms_root_url = configuration_helpers.get_value('LMS_ROOT_URL', settings.LMS_ROOT_URL)
|
||||
email_context = {
|
||||
'course_title': course_title,
|
||||
'course_root': course_root,
|
||||
@@ -119,8 +120,8 @@ def _get_course_email_context(course):
|
||||
'course_url': course_url,
|
||||
'course_image_url': image_url,
|
||||
'course_end_date': course_end_date,
|
||||
'account_settings_url': '{}{}'.format(settings.LMS_ROOT_URL, reverse('account_settings')),
|
||||
'email_settings_url': '{}{}'.format(settings.LMS_ROOT_URL, reverse('dashboard')),
|
||||
'account_settings_url': '{}{}'.format(lms_root_url, reverse('account_settings')),
|
||||
'email_settings_url': '{}{}'.format(lms_root_url, reverse('dashboard')),
|
||||
'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
|
||||
'year': timezone.now().year,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user