From ac365d88f1ce80ddd17f0e0637e5b60669a405bd Mon Sep 17 00:00:00 2001 From: Kristin Aoki <42981026+KristinAoki@users.noreply.github.com> Date: Thu, 7 Nov 2024 13:18:04 -0500 Subject: [PATCH] fix: jump_to url not working for tutor (#35805) * fix: jump_to url not working for tutor * fix: failing test and pylint --- openedx/features/course_experience/url_helpers.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/openedx/features/course_experience/url_helpers.py b/openedx/features/course_experience/url_helpers.py index cdcb0203fc..e1fe4110c6 100644 --- a/openedx/features/course_experience/url_helpers.py +++ b/openedx/features/course_experience/url_helpers.py @@ -12,7 +12,7 @@ from django.http import HttpRequest from django.http.request import QueryDict from django.urls import reverse from opaque_keys.edx.keys import CourseKey, UsageKey -from six.moves.urllib.parse import urlencode, urlparse, urlunparse +from six.moves.urllib.parse import urlencode, urlparse from lms.djangoapps.courseware.toggles import courseware_mfe_is_active from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order @@ -171,9 +171,8 @@ def make_learning_mfe_courseware_url( strings. They're only ever used to concatenate a URL string. `params` is an optional QueryDict object (e.g. request.GET) """ - mfe_link = f'/course/{course_key}' + mfe_link = f'{settings.LEARNING_MICROFRONTEND_URL}/course/{course_key}' get_params = params.copy() if params else None - query_string = '' if preview: if len(get_params.keys()) > 1: @@ -182,7 +181,7 @@ def make_learning_mfe_courseware_url( get_params = None if (unit_key or sequence_key): - mfe_link = f'/preview/course/{course_key}' + mfe_link = f'{settings.LEARNING_MICROFRONTEND_URL}/preview/course/{course_key}' if sequence_key: mfe_link += f'/{sequence_key}' @@ -191,13 +190,9 @@ def make_learning_mfe_courseware_url( mfe_link += f'/{unit_key}' if get_params: - query_string = get_params.urlencode() + mfe_link += f'?{get_params.urlencode()}' - url_parts = list(urlparse(settings.LEARNING_MICROFRONTEND_URL)) - url_parts[2] = mfe_link - url_parts[4] = query_string - - return urlunparse(url_parts) + return mfe_link def get_learning_mfe_home_url(