fix: jump_to url not working for tutor (#35805)

* fix: jump_to url not working for tutor

* fix: failing test and pylint
This commit is contained in:
Kristin Aoki
2024-11-07 13:18:04 -05:00
committed by GitHub
parent 642dae67f1
commit ac365d88f1

View File

@@ -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(