Skip to content

Commit bf6ea14

Browse files
feanilclaude
andcommitted
feat: delete legacy marketing static templates and their URL routes
Remove the 14 template files that were served locally when ENABLE_MKTG_SITE=False. These pages (about, blog, contact, donate, faq, help, honor, jobs, media-kit, news, press, privacy, tos, sitemap.xml) should now only live on the external marketing site configured via MKTG_URLS. Also remove the stanford-style theme overrides for about.html and tos.html, the hardcoded URL patterns for the deleted templates, the honor.html iframing special case from the render view, and the tests that exercised these now-deleted routes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ee4e2c1 commit bf6ea14

23 files changed

Lines changed: 11 additions & 432 deletions

File tree

common/djangoapps/student/tests/test_views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,13 +1086,13 @@ def test_user_with_unacknowledged_notice(self, mock_notices):
10861086
Verifies that we will redirect the learner to the URL returned from the `check_for_unacknowledged_notices`
10871087
function.
10881088
"""
1089-
mock_notices.return_value = reverse("about")
1089+
mock_notices.return_value = reverse("root")
10901090

10911091
with override_settings(FEATURES={**settings.FEATURES, 'ENABLE_NOTICES': True}):
10921092
response = self.client.get(self.path)
10931093

10941094
assert response.status_code == 302
1095-
assert response.url == "/about"
1095+
assert response.url == "/"
10961096
mock_notices.assert_called_once()
10971097

10981098
@patch('common.djangoapps.student.views.dashboard.check_for_unacknowledged_notices')

lms/djangoapps/learner_home/test_views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ def test_happy_path(self, mock_marketing_link):
7676

7777
@ddt.data(
7878
(True, f'{settings.CATALOG_MICROFRONTEND_URL}/courses'),
79-
(False, '/courses'),
79+
(False, '#'),
8080
)
8181
@ddt.unpack
8282
def test_link_with_new_catalog_page(self, catalog_mfe_enabled, expected_catalog_link):
8383
"""
8484
Test that the catalog link is constructed correctly based on the MFE flags.
85+
When the catalog MFE is disabled, marketing_link('COURSES') is used; '#' is
86+
returned when MKTG_URLS has no COURSES entry.
8587
"""
8688
with override_settings(ENABLE_CATALOG_MICROFRONTEND=catalog_mfe_enabled):
8789
assert get_platform_settings()["courseSearchUrl"] == expected_catalog_link

lms/djangoapps/static_template_view/tests/test_views.py

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,62 +7,10 @@
77
from django.test import TestCase
88
from django.urls import reverse
99

10-
from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration_context
11-
1210

1311
class MarketingSiteViewTests(TestCase):
1412
""" Tests for the marketing site views """
1513

16-
def _test_view(self, view_name, mimetype):
17-
"""
18-
Gets a view and tests that it exists.
19-
"""
20-
resp = self.client.get(reverse(view_name))
21-
assert resp.status_code == 200
22-
assert resp['Content-Type'] == mimetype
23-
24-
def test_sitemap(self):
25-
"""
26-
Test the sitemap view
27-
"""
28-
self._test_view('sitemap_xml', 'application/xml')
29-
30-
def test_about(self):
31-
"""
32-
Test the about view
33-
"""
34-
self._test_view('about', 'text/html')
35-
36-
def test_about_with_site_configuration(self):
37-
"""
38-
Test the about view with the header and content set in SiteConfiguration.
39-
"""
40-
test_header = "Very Unique Test Header"
41-
test_content = "Very Unique Test Content"
42-
test_header_key = 'static_template_about_header'
43-
test_content_key = 'static_template_about_content'
44-
response = None
45-
configuration = {test_header_key: test_header, test_content_key: test_content}
46-
with with_site_configuration_context(configuration=configuration):
47-
response = self.client.get(reverse("about"))
48-
self.assertContains(response, test_header)
49-
self.assertContains(response, test_content)
50-
51-
def test_about_with_site_configuration_and_html(self):
52-
"""
53-
Test the about view with html in the header.
54-
"""
55-
test_header = "<i>Very Unique Test Header</i>"
56-
test_content = "<i>Very Unique Test Content</i>"
57-
test_header_key = 'static_template_about_header'
58-
test_content_key = 'static_template_about_content'
59-
response = None
60-
configuration = {test_header_key: test_header, test_content_key: test_content}
61-
with with_site_configuration_context(configuration=configuration):
62-
response = self.client.get(reverse("about"))
63-
self.assertContains(response, test_header)
64-
self.assertContains(response, test_content)
65-
6614
def test_404(self):
6715
"""
6816
Test the 404 view.

lms/djangoapps/static_template_view/urls.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@
88
from lms.djangoapps.static_template_view import views
99

1010
urlpatterns = [
11-
path('blog', views.render, {'template': 'blog.html'}, name="blog"),
12-
path('contact', views.render, {'template': 'contact.html'}, name="contact"),
13-
path('donate', views.render, {'template': 'donate.html'}, name="donate"),
14-
path('faq', views.render, {'template': 'faq.html'}, name="faq"),
15-
path('help', views.render, {'template': 'help.html'}, name="help_edx"),
16-
path('jobs', views.render, {'template': 'jobs.html'}, name="jobs"),
17-
path('news', views.render, {'template': 'news.html'}, name="news"),
18-
path('press', views.render, {'template': 'press.html'}, name="press"),
19-
path('media-kit', views.render, {'template': 'media-kit.html'}, name="media-kit"),
2011
path('copyright', views.render, {'template': 'copyright.html'}, name="copyright"),
2112

2213
# Press releases

lms/djangoapps/static_template_view/views.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ def render(request, template):
5858

5959
try:
6060
context = {}
61-
# This is necessary for the dialog presented with the TOS in /register
62-
if template == 'honor.html':
63-
context['allow_iframing'] = True
6461
# Format Examples: static_template_about_header
6562
configuration_base = 'static_template_' + template.replace('.html', '').replace('-', '_')
6663
page_header = configuration_helpers.get_value(configuration_base + '_header')

lms/djangoapps/support/views/contact_us.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from django.shortcuts import redirect
99
from django.views.generic import View
1010

11-
from common.djangoapps.edxmako.shortcuts import render_to_response
11+
from common.djangoapps.edxmako.shortcuts import marketing_link, render_to_response
1212
from common.djangoapps.student.models import CourseEnrollment
1313
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
1414
from openedx.features.enterprise_support import api as enterprise_api
@@ -23,7 +23,8 @@ def get(self, request): # pylint: disable=missing-function-docstring
2323
# If ZENDESK_URL is not defined, then it will redirect to the static contact page
2424
# to avoid 500 error that arises due to missing Zendesk configuration
2525
if not settings.ZENDESK_URL:
26-
return redirect('contact')
26+
contact_url = marketing_link('CONTACT')
27+
return redirect(contact_url if contact_url != '#' else '/')
2728

2829
if not configuration_helpers.get_value('CONTACT_US_PAGE', True):
2930
raise Http404

lms/templates/signup_modal.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from openedx.core.djangolib.markup import HTML, Text
55
from openedx.core.djangolib.js_utils import js_escaped_string
66
from django.conf import settings
7-
from django.urls import reverse
7+
from common.djangoapps.edxmako.shortcuts import marketing_link
88
from django_countries import countries
99
from common.djangoapps.student.models import UserProfile
1010
from datetime import date
@@ -134,15 +134,15 @@ <h2>
134134
<label data-field="terms_of_service" class="terms-of-service" for="signup_tos">
135135
<input id="signup_tos" name="terms_of_service" type="checkbox" value="true">
136136
${Text(_('I agree to the {link_start}Terms of Service{link_end}')).format(
137-
link_start=HTML('<a href="{url}" rel="noopener" target="_blank">').format(url=reverse('tos')),
137+
link_start=HTML('<a href="{url}" rel="noopener" target="_blank">').format(url=marketing_link('TOS')),
138138
link_end=HTML('</a>'))} *
139139
</label>
140140

141141
% if settings.REGISTRATION_EXTRA_FIELDS['honor_code'] != 'hidden':
142142
<label data-field="honor_code" class="honor-code" for="signup_honor">
143143
<input id="signup_honor" name="honor_code" type="checkbox" value="true">
144144
${Text(_('I agree to the {link_start}Honor Code{link_end}')).format(
145-
link_start=HTML('<a href="{url}" rel="noopener" target="_blank">').format(url=reverse('honor')),
145+
link_start=HTML('<a href="{url}" rel="noopener" target="_blank">').format(url=marketing_link('HONOR')),
146146
link_end=HTML('</a>'))} *
147147
</label>
148148
% endif

lms/templates/static_templates/about.html

Lines changed: 0 additions & 16 deletions
This file was deleted.

lms/templates/static_templates/blog.html

Lines changed: 0 additions & 16 deletions
This file was deleted.

lms/templates/static_templates/contact.html

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)