|
29 | 29 | from lms.lib.utils import get_parent_unit |
30 | 30 | from openedx.core.djangoapps.oauth_dispatch.jwt import create_jwt_for_user |
31 | 31 | from openedx.core.djangolib.markup import Text |
| 32 | +from openedx.features.course_experience.url_helpers import get_courseware_url |
32 | 33 | from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order |
33 | 34 | from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order |
34 | 35 |
|
@@ -256,16 +257,8 @@ def get_block_context(course, block): |
256 | 257 | course = block.get_parent() |
257 | 258 | block_dict['index'] = get_index(block_dict['location'], course.children) |
258 | 259 | 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) |
269 | 262 | if block.category in ('chapter', 'sequential'): |
270 | 263 | block_dict['children'] = [str(child) for child in block.children] |
271 | 264 |
|
|
0 commit comments