Skip to content

feat: drop ENABLE_MKTG_SITE flag and MKTG_URL_LINK_MAP setting#38720

Open
feanil wants to merge 10 commits into
masterfrom
feanil/depr_legacy_static
Open

feat: drop ENABLE_MKTG_SITE flag and MKTG_URL_LINK_MAP setting#38720
feanil wants to merge 10 commits into
masterfrom
feanil/depr_legacy_static

Conversation

@feanil

@feanil feanil commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #37053.

Removes the ENABLE_MKTG_SITE feature flag, the companion MKTG_URL_LINK_MAP setting, and the legacy static marketing templates that were served locally when ENABLE_MKTG_SITE=False. All code now behaves as if the flag were always True — marketing links resolve via MKTG_URLS only.

BREAKING CHANGES

ENABLE_MKTG_SITE setting removed.

Any operator configuration that sets ENABLE_MKTG_SITE (in YAML, environment variables, or SiteConfiguration) will have that value silently ignored. Code that reads settings.FEATURES.get('ENABLE_MKTG_SITE') or settings.ENABLE_MKTG_SITE will get None/AttributeError respectively. Ensure MKTG_URLS is configured as the replacement before upgrading.

MKTG_URL_LINK_MAP setting removed.

Any operator configuration that sets MKTG_URL_LINK_MAP will have it silently ignored. Marketing links now resolve exclusively via MKTG_URLS.

ENABLE_COURSE_HOME_REDIRECT default changed from True to False.

Previously this flag only had effect when ENABLE_MKTG_SITE=True, so it was silently ignored by most operators. Now that ENABLE_MKTG_SITE is removed, it is the sole gate controlling whether /courses/<id>/about redirects to the learning MFE course home instead of rendering the about page HTML.

The default is False to preserve existing behavior for operators who were not using ENABLE_MKTG_SITE=True. Operators who previously had ENABLE_MKTG_SITE=True and relied on the course-about-to-MFE redirect must now explicitly set ENABLE_COURSE_HOME_REDIRECT=True to preserve that behavior.

Deleted marketing template URL routes.

The following URL names no longer exist — direct references such as reverse('about') or reverse('tos') will raise NoReverseMatch:

about, blog, contact, donate, faq, help, honor, jobs, media-kit, news, press, privacy, tos, sitemap.xml

Use marketing_link('ABOUT'), marketing_link('TOS'), etc. instead, which resolve via MKTG_URLS.

What is NOT changed

  • Error templates (404, 429, server-down, server-error, server-overloaded)
  • MKTG_URLS and MKTG_URL_OVERRIDES settings (the replacement mechanism)
  • The press_release URL pattern (serves press_releases/ directory)
  • The /courses URL route — now resolves via catalog MFE → MKTG_URLS['COURSES'] → local course list page

MFE impact and follow-up

The CMS course settings API (GET /api/contentstore/v1/course_settings/{course_id}) includes a marketing_enabled field previously driven by ENABLE_MKTG_SITE. It now always returns True, which changes the UI shown in frontend-app-authoring's Schedule & Details page from an enrollment card to a dismissible promotional banner.

Follow-up PR in frontend-app-authoring (#3088): removes the marketingEnabled conditional, always renders the banner, and exports CoursePromotionCard so operators can restore the old enrollment card via PageBannerSlot if needed. The marketing_enabled API field and CoursePromotionCard will be fully removed in the "Y" release (tracked in #38727).

@feanil feanil force-pushed the feanil/depr_legacy_static branch from 022fef1 to 28e34b7 Compare June 5, 2026 15:01
Verify the correct about URL base is used when neither social sharing URL nor
marketing URL is set (catalog MFE URL vs LMS root URL).
"""
self.course_overview.marketing_url = None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewer:

setUp always sets marketing_url = 'test_marketing_url'. Previously, an ENABLE_MKTG_SITE gate in
get_link_for_about_page prevented that value from being used, so the test happened to reach the
fallback path anyway. After removing the gate, marketing_url is checked unconditionally, so the test
has to explicitly clear it to force the function into the fallback path it's actually testing.

feanil added a commit that referenced this pull request Jun 8, 2026
The E003 check required MKTG_URLS['ROOT'] to be defined, but this key
is optional. The index() view in branding/views.py already handles the
case where ROOT is absent:

    root_url = marketing_urls.get("ROOT")
    if root_url and root_url != getattr(settings, "LMS_ROOT_URL", None):
        return redirect(root_url)

Previously, E003 was only triggered when ENABLE_MKTG_SITE=True (the
check was guarded by that flag). After removing ENABLE_MKTG_SITE in
#38720, the check runs
unconditionally and fires in any environment where MKTG_URLS has no
ROOT key (including test and CMS environments). Since ROOT is genuinely
optional, the check is incorrect and should not be enforced.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feanil added a commit that referenced this pull request Jun 11, 2026
The E003 check required MKTG_URLS['ROOT'] to be defined, but this key
is optional. The index() view in branding/views.py already handles the
case where ROOT is absent:

    root_url = marketing_urls.get("ROOT")
    if root_url and root_url != getattr(settings, "LMS_ROOT_URL", None):
        return redirect(root_url)

Previously, E003 was only triggered when ENABLE_MKTG_SITE=True (the
check was guarded by that flag). After removing ENABLE_MKTG_SITE in
#38720, the check runs
unconditionally and fires in any environment where MKTG_URLS has no
ROOT key (including test and CMS environments). Since ROOT is genuinely
optional, the check is incorrect and should not be enforced.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@feanil feanil force-pushed the feanil/depr_legacy_static branch from d47f2e0 to 53eba85 Compare June 11, 2026 19:15
…lution

ENABLE_MKTG_SITE was a feature flag that selected between two URL resolution
strategies: MKTG_URLS (external marketing site) vs MKTG_URL_LINK_MAP (local
Django URL reversal). The local-template path is now legacy; all operators
are expected to use MKTG_URLS.

This commit removes the flag and its conditional branches, keeping the
MKTG_URLS-based behaviour unconditionally:

- Drop the setting definition and toggle annotation from openedx/envs/common.py
- Remove the override from lms/envs/devstack.py and both mock.yml files
- Simplify marketing_link() and is_marketing_link_set() in edxmako/shortcuts.py
  to always consult MKTG_URLS; drop the MKTG_URL_LINK_MAP fallback branches and
  the now-unused NoReverseMatch/reverse/set_custom_attribute/get_current_request_hostname imports
- Update validate_marketing_site_setting() in checks.py to always validate
  MKTG_URLS rather than gating validation on ENABLE_MKTG_SITE
- Trim edxmako/tests.py: remove False-path test variants and the MKTG_URL_LINK_MAP
  link-reversal test; each remaining test now exercises a single, unconditional code path

Part of #37053

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feanil added a commit that referenced this pull request Jun 22, 2026
The E003 check required MKTG_URLS['ROOT'] to be defined, but this key
is optional. The index() view in branding/views.py already handles the
case where ROOT is absent:

    root_url = marketing_urls.get("ROOT")
    if root_url and root_url != getattr(settings, "LMS_ROOT_URL", None):
        return redirect(root_url)

Previously, E003 was only triggered when ENABLE_MKTG_SITE=True (the
check was guarded by that flag). After removing ENABLE_MKTG_SITE in
#38720, the check runs
unconditionally and fires in any environment where MKTG_URLS has no
ROOT key (including test and CMS environments). Since ROOT is genuinely
optional, the check is incorrect and should not be enforced.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@feanil feanil force-pushed the feanil/depr_legacy_static branch 2 times, most recently from 4f76506 to 61f465f Compare June 22, 2026 16:52
@feanil feanil marked this pull request as ready for review June 22, 2026 17:28
@feanil feanil requested review from a team and kdmccormick as code owners June 22, 2026 17:28
@feanil feanil added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Jun 22, 2026
feanil and others added 9 commits June 22, 2026 13:59
index() (served at /) now unconditionally checks MKTG_URLS['ROOT'] and
redirects when it differs from LMS_ROOT_URL, matching the previous
ENABLE_MKTG_SITE=True behaviour. The catalog MFE redirect
(ENABLE_CATALOG_MICROFRONTEND) still fires first and is unaffected.
Also fixes a pre-existing bug where log.error() in the NoReverseMatch
handler was passed multiple f-strings as positional args, causing a
TypeError when that branch was reached.

courses() (served at /courses) now resolves in priority order:
1. Redirect to the catalog MFE if ENABLE_CATALOG_MICROFRONTEND is set
2. Permanent redirect to marketing_link('COURSES') from MKTG_URLS
3. Render the local course list via courseware.views.views.courses()

The old ENABLE_MKTG_SITE gate and COURSES_ARE_BROWSABLE guard are
removed. The local course list fallback (case 3) preserves behaviour
for operators who have neither the catalog MFE nor MKTG_URLS['COURSES']
configured.

The stanford-style theme footer is updated to use marketing_link()
instead of reverse() for the 'about' and 'tos' URL routes, which are
removed in a later commit.

Tests drop their @override_settings(ENABLE_MKTG_SITE=True) decorators;
the test names and assertions are otherwise unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… API

- course_about_url in enrollment emails now uses
  get_link_for_about_page(), resolving the marketing URL, social sharing
  URL, or LMS about URL as a fallback
- get_link_for_about_page() uses course.marketing_url unconditionally
- has_marketing_url() returns bool(self.marketing_url) directly
- url_to_enroll() always returns marketing_link('COURSES')
- _course_home_redirect_enabled() only checks ENABLE_COURSE_HOME_REDIRECT;
  default changed from True to False because the flag previously had no
  effect when ENABLE_MKTG_SITE=False (the old default) — operators who
  relied on ENABLE_MKTG_SITE=True to activate the course-about redirect
  must now set ENABLE_COURSE_HOME_REDIRECT=True explicitly
- Remove ENABLE_MKTG_SITE patches from courseware, instructor, and
  mobile API tests; merge redundant test cases where applicable

BREAKING CHANGE: ENABLE_COURSE_HOME_REDIRECT now defaults to False.
Operators who previously had ENABLE_MKTG_SITE=True and want the
course about page to redirect to the learning MFE must explicitly set
ENABLE_COURSE_HOME_REDIRECT=True in their configuration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Email change confirmation contact link now always comes from
marketing_link('CONTACT') via MKTG_URLS. Remove the fallback that
constructed a local URL when the flag was False.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- contentstore utils: marketing_enabled is always True
- registration tests: remove ENABLE_MKTG_SITE=False test cases that
  tested now-dead local URL generation for honor code and TOS links;
  remove ENABLE_MKTG_SITE=True decorators from the remaining tests
- site_configuration test mixin: remove ENABLE_MKTG_SITE example key
- schedules README: remove ENABLE_MKTG_SITE from example config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Marketing navigation links (HOW_IT_WORKS, COURSES, SCHOOLS) are now
always rendered in the unauthenticated nav bars. marketing_link() falls
back to '#' when a URL is not configured in MKTG_URLS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This setting was the fallback URL resolution mechanism used when
ENABLE_MKTG_SITE=False. Now that the flag is gone, only MKTG_URLS is
used for marketing link resolution.

- Remove MKTG_URL_LINK_MAP definition from openedx/envs/common.py
- Remove LMS-specific update block from lms/envs/common.py
- Remove test environment override from lms/envs/test.py
- Remove YAML loading and dict-update from lms and cms production envs
- Remove the dynamic URL registration loop from static_template_view
- Remove MKTG_URL_LINK_MAP.keys() union from the marketing link
  context processor in edxmako/shortcuts.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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>
The E003 check required MKTG_URLS['ROOT'] to be defined, but this key
is optional. The index() view in branding/views.py already handles the
case where ROOT is absent:

    root_url = marketing_urls.get("ROOT")
    if root_url and root_url != getattr(settings, "LMS_ROOT_URL", None):
        return redirect(root_url)

Previously, E003 was only triggered when ENABLE_MKTG_SITE=True (the
check was guarded by that flag). After removing ENABLE_MKTG_SITE in
#38720, the check runs
unconditionally and fires in any environment where MKTG_URLS has no
ROOT key (including test and CMS environments). Since ROOT is genuinely
optional, the check is incorrect and should not be enforced.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ails

With ENABLE_MKTG_SITE removed, get_email_params() now always sets
course_about_url via get_link_for_about_page(), which never returns None
(it falls back to the LMS course about URL). The instructor "allowed
enroll" and "add beta tester" ACE email templates branched on
`course_about_url is not None`, keeping an else-branch for the old
marketing-site-enabled case where course_about_url was None.

Those conditionals are now always true and their else-branches are dead:
- allowedenroll: "You can then enroll in {{ course_name }}."
- addbetatester: "Visit {{ site_name }} to enroll in this course and
  begin the beta test."

Collapse the always-true `course_about_url is not None` guards to the
unconditional branch and delete the unreachable text (both .txt and .html
variants). No behavior change for any reachable input.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@feanil feanil force-pushed the feanil/depr_legacy_static branch from 61f465f to 6c2a280 Compare June 22, 2026 17:59
Verifies that we will redirect the learner to the URL returned from the `check_for_unacknowledged_notices`
function.
"""
mock_notices.return_value = reverse("about")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The about page was removed so this test was previously breaking. Switched to the root which still returns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create-sandbox open-craft-grove should create a sandbox environment from this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DEPR]: Drop ENABLE_MKTG_SITE flag and legacy static templates

1 participant