Skip to content

Commit 3955c5c

Browse files
authored
fix: use MFE-aware URL instead of legacy when generating block URL (openedx#36526) (openedx#36871)
1 parent 4a0d77a commit 3955c5c

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

lms/djangoapps/edxnotes/helpers.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from lms.lib.utils import get_parent_unit
3030
from openedx.core.djangoapps.oauth_dispatch.jwt import create_jwt_for_user
3131
from openedx.core.djangolib.markup import Text
32+
from openedx.features.course_experience.url_helpers import get_courseware_url
3233
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
3334
from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order
3435

@@ -256,16 +257,8 @@ def get_block_context(course, block):
256257
course = block.get_parent()
257258
block_dict['index'] = get_index(block_dict['location'], course.children)
258259
elif block.category == 'vertical':
259-
section = block.get_parent()
260-
chapter = section.get_parent()
261-
# Position starts from 1, that's why we add 1.
262-
position = get_index(str(block.location), section.children) + 1
263-
block_dict['url'] = reverse('courseware_position', kwargs={
264-
'course_id': str(course.id),
265-
'chapter': chapter.url_name,
266-
'section': section.url_name,
267-
'position': position,
268-
})
260+
# Use the MFE-aware URL generator instead of always using the legacy URL format
261+
block_dict['url'] = get_courseware_url(block.location)
269262
if block.category in ('chapter', 'sequential'):
270263
block_dict['children'] = [str(child) for child in block.children]
271264

0 commit comments

Comments
 (0)