From 0fc0f822567f1b63c195ffe1828b21ca1066ac99 Mon Sep 17 00:00:00 2001 From: Hamza Munir Date: Wed, 11 Apr 2018 14:04:37 +0500 Subject: [PATCH] Changing the contact-us link Redirection to the newly created support form. If the server is production it will take to production support form otherwise it will be forwarded to Stage server support form. LEARNER-4873 --- lms/djangoapps/branding/api.py | 8 +++++++- lms/djangoapps/branding/tests/test_api.py | 8 +++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lms/djangoapps/branding/api.py b/lms/djangoapps/branding/api.py index e1e67691bc..b1efafb39e 100644 --- a/lms/djangoapps/branding/api.py +++ b/lms/djangoapps/branding/api.py @@ -22,6 +22,7 @@ from django.utils.translation import ugettext as _ from branding.models import BrandingApiConfig from edxmako.shortcuts import marketing_link + from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers log = logging.getLogger("edx.footer") @@ -171,6 +172,7 @@ def _footer_social_links(): def _footer_connect_links(): """Return the connect links to display in the footer. """ + return [ { "name": link_name, @@ -179,7 +181,7 @@ def _footer_connect_links(): } for link_name, link_url, link_title in [ ("blog", marketing_link("BLOG"), _("Blog")), - ("contact", reverse("support:contact_us"), _("Contact Us")), + ("contact", _build_support_form_url(), _("Contact Us")), ("help-center", settings.SUPPORT_SITE_LINK, _("Help Center")), ("media_kit", marketing_link("MEDIA_KIT"), _("Media Kit")), ("donate", marketing_link("DONATE"), _("Donate")), @@ -188,6 +190,10 @@ def _footer_connect_links(): ] +def _build_support_form_url(): + return '{base_url}/support/contact_us'.format(base_url=settings.LMS_ROOT_URL) + + def _footer_navigation_links(): """Return the navigation links to display in the footer. """ platform_name = configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME) diff --git a/lms/djangoapps/branding/tests/test_api.py b/lms/djangoapps/branding/tests/test_api.py index 9fd9439619..d2040bdfc7 100644 --- a/lms/djangoapps/branding/tests/test_api.py +++ b/lms/djangoapps/branding/tests/test_api.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import mock +from django.conf import settings from django.core.urlresolvers import reverse from django.test import TestCase from django.test.utils import override_settings @@ -65,9 +66,6 @@ class TestFooter(TestCase): @override_settings(PLATFORM_NAME='\xe9dX') def test_get_footer(self): actual_footer = get_footer(is_secure=True) - import pprint - pprint.pprint(actual_footer) - print('******************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!*******************************************') expected_footer = { 'copyright': '\xa9 \xe9dX. All rights reserved except where noted. ' ' EdX, Open edX and their respective logos are ' @@ -105,7 +103,8 @@ class TestFooter(TestCase): ], 'connect_links': [ {'url': 'https://edx.org/edx-blog', 'name': 'blog', 'title': 'Blog'}, - {'url': '/support/contact_us', 'name': 'contact', 'title': 'Contact Us'}, + # pylint: disable=line-too-long + {'url': '{base_url}/support/contact_us'.format(base_url=settings.LMS_ROOT_URL), 'name': 'contact', 'title': 'Contact Us'}, {'url': 'https://support.example.com', 'name': 'help-center', 'title': 'Help Center'}, {'url': 'https://edx.org/media-kit', 'name': 'media_kit', 'title': 'Media Kit'}, {'url': 'https://edx.org/donate', 'name': 'donate', 'title': 'Donate'} @@ -149,5 +148,4 @@ class TestFooter(TestCase): 'text': 'Take free online courses at edX.org', }, } - pprint.pprint(expected_footer) self.assertEqual(actual_footer, expected_footer)