Skip to content

feat: replace enterprise_support imports in Mako templates with pluggable overrides - #39162

Merged
pwnage101 merged 2 commits into
masterfrom
pwnage101/ENT-12353-openedx
Sep 29, 2026
Merged

pwnage101 merged 2 commits into
masterfrom
pwnage101/ENT-12353-openedx

Conversation

@pwnage101

Copy link
Copy Markdown
Contributor

Note: This PR is the upstream version of edx#486


Removes enterprise imports from several Mako templates. Replacement values provided as pluggable overrides in lms/djangoapps/branding/api.py.

  • get_learner_display_username(user) - an appropriate display username used throughout the interface.
  • get_enterprise_learner_portal_link() - link to the enterprise learner portal for the given user, if one exists.

ENT-12353

@pwnage101
pwnage101 requested a review from a team as a code owner September 29, 2026 15:32
@pwnage101
pwnage101 force-pushed the pwnage101/ENT-12353-openedx branch from 0500e32 to 29085f7 Compare September 29, 2026 15:44
Comment on lines +731 to +733
if not settings.ORDER_HISTORY_MICROFRONTEND_URL:
# There is no order history microfrontend to send anyone to.
return False

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.

This check is the only substantial difference from the original edx-platform PR since conditionally rendering the order history button based on this setting seems to be an upstream addition to the template so I just pulled it up into the python API here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The logo refactor breaks the existing Stanford theme override, and progress-template integration lacks coverage.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Replaces direct enterprise dependencies in LMS Mako templates with pluggable branding APIs.

Changes:

  • Adds overridable learner display-name and portal-link helpers.
  • Migrates header, dropdown, and progress templates.
  • Adds helper and template tests.
File Description
lms/​djangoapps/​branding/​api.py Adds pluggable branding helpers.
lms/​djangoapps/​branding/​tests/​test_api.py Tests helpers and header rendering.
lms/​templates/​user_dropdown.html Uses the display-name helper.
lms/​templates/​header/​user_dropdown.html Uses dashboard, name, and order-history helpers.
lms/​templates/​header/​navbar-logo-header.html Uses the header-logo helper.
lms/​templates/​courseware/​progress.html Uses the display-name helper.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lms/templates/courseware/progress.html
Comment thread lms/templates/header/navbar-logo-header.html Outdated

@brobro10000 brobro10000 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Matches the already-merged edx#486 (ENT-12353) — same hook names (OVERRIDE_GET_LEARNER_DISPLAY_USERNAME, OVERRIDE_GET_ENTERPRISE_LEARNER_PORTAL_LINK), so it'll connect to the already-released enterprise override correctly. Blocking on one thing, see inline comment: this PR doesn't bump the edx-enterprise pin anywhere.



@pluggable_override('OVERRIDE_GET_LEARNER_DISPLAY_USERNAME')
def get_learner_display_username(user: AbstractBaseUser) -> str:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This hook needs edx-enterprise>=8.17.0 to do anything — that's the release containing openedx/edx-enterprise#2697's enterprise_learner_generic_name, registered under this exact setting name. This PR doesn't touch pyproject.toml / requirements/*.txt / uv.lock anywhere, unlike #39161's 8.14.0→8.15.0 bump for the sibling ticket. Please bump the pin to 8.17.0 here too, or this merges and silently no-ops in production — the same failure mode edx#486 almost shipped with.

@brobro10000 brobro10000 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving to unblock b/c I know you will handle it before it is merged.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The logo extension point causes comprehensive themes to suppress enterprise portal logos.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (2)

Comment thread lms/templates/header/navbar-logo-header.html
…able overrides

Removes enterprise imports from several Mako templates. Replacement
values provided as pluggable overrides in lms/djangoapps/branding/api.py.

- get_learner_display_username(user) - an appropriate display username used
  throughout the interface.
- get_enterprise_learner_portal_link() - link to the enterprise learner
  portal for the given user, if one exists.

ENT-12353
Dropping the navigation_logo named block was an accident which likely
broke comprehensive themes (e.g. stanford-style) which may declare an
override.

ENT-12353
@pwnage101
pwnage101 force-pushed the pwnage101/ENT-12353-openedx branch from 4ff1aed to 865f3b7 Compare September 29, 2026 16:58
@pwnage101
pwnage101 enabled auto-merge September 29, 2026 16:58
@pwnage101
pwnage101 merged commit 0d9394e into master Sep 29, 2026
45 checks passed
@pwnage101
pwnage101 deleted the pwnage101/ENT-12353-openedx branch September 29, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants