Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lms/templates/header/user_dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="mobile-nav-item dropdown-item dropdown-nav-item"><a href="${settings.ENTERPRISE_LEARNER_PORTAL_BASE_URL}/${enterprise_customer_portal.get('slug')}" role="menuitem">${_("Dashboard")}</a></div>
% endif

<div class="mobile-nav-item dropdown-item dropdown-nav-item"><a href="${urljoin(settings.PROFILE_MICROFRONTEND_URL, f'/u/{user.username}')}" role="menuitem">${_("Profile")}</a></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the default profile MFE does have it's path this way; https://github.com/openedx/frontend-app-profile/blob/master/src/routes/AppRoutes.jsx#L11

Where it expects the /u/ so is this an issue where that "requirement" is not being met for some reason?

Copy link
Member

Choose a reason for hiding this comment

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

The issue comes up when using this MFE together with the per_path install option which is the tutor-mfe default.
When you use tutor-mfe, then domain.com/profile/ is used as the root and a real profile url would look like domain.com/profile/u/<username>. The u/ is to be expected, but having the link start with the leading / makes this replace /profile/u/ with /u/ and thus the MFE root is never reached.

An example from the python console is easier to understand:

>>> from urllib.parse import urljoin

>>> urljoin('https://mydomain.com/profile/', f'/u/<username>')  # <-- this is what we are seeing
'https://mydomain.com/u/<username>'

>>> urljoin('https://mydomain.com/profile/u/', f'<username>')  # <-- this is what the fix suggests we should do
'https://mydomain.com/profile/u/<username>'

Copy link
Member

Choose a reason for hiding this comment

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

but this change isn't doing what you show in this code sample, unless settings.PROFILE_MICROFRONTEND_URL is doing something I definitely don't understand. It appears to me that the /u/ has been knocked out entirely in the urljoin call. am I missing something?

Copy link
Member

Choose a reason for hiding this comment

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

oh huh I AM missing something, I just went and looked and I see that for our instance that's set as

PROFILE_MICROFRONTEND_URL: https://profile.ourdomain/u/

We surely don't enforce that, but I assume it should work fine even if people don't have it set up that way? Hmm.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it that makes sense, I was confused because the defaults in edx-platform also don't have /u/ suffix on the default PROFILE_MICROFRONTEND_URL setting in test and devstack settings. No issues from my perspective on this.

<div class="mobile-nav-item dropdown-item dropdown-nav-item"><a href="${urljoin(settings.PROFILE_MICROFRONTEND_URL, f'{user.username}')}" role="menuitem">${_("Profile")}</a></div>
<div class="mobile-nav-item dropdown-item dropdown-nav-item"><a href="${settings.ACCOUNT_MICROFRONTEND_URL}" role="menuitem">${_("Account")}</a></div>
% if should_show_order_history:
<div class="mobile-nav-item dropdown-item dropdown-nav-item"><a href="${settings.ORDER_HISTORY_MICROFRONTEND_URL}" role="menuitem">${_("Order History")}</a></div>
Expand Down
Loading