Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make courseware URLs more human-readable #28174

Closed
wants to merge 63 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
a9f61b5
Update current
Jul 13, 2021
dfbcd79
merge master
Jul 13, 2021
6239b68
Update path to location to hash the location of blocks
Jul 19, 2021
3843786
Replace encoding with function to hash block id
Jul 19, 2021
4870e08
Add function to store mapping of hash keys and block ids
Jul 19, 2021
195d212
Change the decoding of hash to use mapping function
Jul 19, 2021
a355dac
Add experience parameter to identify which url is being built
Jul 19, 2021
cde19a1
Merge branch 'master' into KristinAoki/TNL-8511
Jul 19, 2021
d2312fd
Merge branch 'master' into KristinAoki/TNL-8511
Jul 19, 2021
f46df34
Add loop to add hash_key to units via sequence metadata
Jul 21, 2021
1aba481
Update hash to return as a string instead of bytes string
Jul 21, 2021
470b87c
Merge branch 'master' into KristinAoki/TNL-8511
KristinAoki Jul 21, 2021
0f2f1c8
Add check for hashed usage keys and decoded them
Jul 21, 2021
8e15f6b
Set hash key as item id and store original id as decoded_id
Jul 21, 2021
081d79c
Merge branch 'KristinAoki/TNL-8511' of github.com:edx/edx-platform in…
Jul 26, 2021
5bafb69
Fix PEP 8 errors
Jul 26, 2021
41122b9
Add conditional block type check to add proper childre references
Jul 26, 2021
958b994
Change available_seq_ids from usage keys to hash keys
Jul 26, 2021
c4d61d9
Add hash_key to all blocks in course outline
Jul 26, 2021
8f88489
Update sequences list to be stored by hash key instead of usage key
Jul 26, 2021
d0f6450
Fix PEP 8 errors
Jul 28, 2021
8f07f17
Merge branch 'master' into KristinAoki/TNL-8511
Jul 28, 2021
8fe1ecd
Add hash_children parameter to block
Jul 30, 2021
5602d4e
Change sequence ids to be stored by hash key
Jul 30, 2021
290b61c
Fix undefined parameter error
Aug 2, 2021
2e82262
Update order of parameters to match parameters in function
Aug 2, 2021
d786d1f
Removed unused import
Aug 2, 2021
f5e3324
Remove whitespace
Aug 2, 2021
ead35a8
Fix variable name conflict
Aug 2, 2021
5082dd6
Fix PEP-8 errors
Aug 2, 2021
966a7ce
Merge branch 'master' into KristinAoki/TNL-8511
Aug 2, 2021
eb3bbe0
Update protected variable misuse
Aug 3, 2021
5b73a7e
Fix line length errors
Aug 3, 2021
6488f7b
Fix PEP-8 errors
Aug 3, 2021
4e1d655
Update path to be based on hash key instead of usage key
Aug 3, 2021
9582f0f
Add conditional check for mfe short url flag for all hash key edits
Aug 4, 2021
c233b93
Add feature flag to toggle short MFE urls
Aug 4, 2021
4ef0b73
Update experience check
Aug 4, 2021
bef4111
Add experience parameter to all path_to_location calls
Aug 4, 2021
7a33d78
Fix default flag
Aug 4, 2021
2063d85
Merge branch 'master' into KristinAoki/TNL-8511
KristinAoki Aug 4, 2021
3bc7172
Add property to pass mfe short url to frontend
Aug 4, 2021
ae88a4e
Fix Jenkins quality errors
Aug 4, 2021
32b3813
Fix Jenkins quality errors
Aug 4, 2021
e63a7a8
Remove all LMS specific code
Aug 6, 2021
8a78776
Update get_usage_key_hash function import
Aug 6, 2021
98d859f
Add get_usage_key_hash function
Aug 6, 2021
093eef0
Remove extra hash functions
Aug 6, 2021
5ed3aae
Add feature flag for short mfe urls
Aug 6, 2021
2851110
Add condition to check if response is a dict or list
Aug 9, 2021
27968a0
Update test to match new URL format
Aug 9, 2021
64d14af
Update test to match new URL format
Aug 9, 2021
dea27ab
Remove print statements
Aug 9, 2021
c730754
Fix missing hash_key in block
Aug 9, 2021
6f90485
Remove flag conditional checks
Aug 10, 2021
41888c7
Add parameter to pass flag to frontnd
Aug 10, 2021
5c65970
Fix Jenkins quality errors
Aug 10, 2021
27d9c89
Fix Jenkins quality error
Aug 10, 2021
632c3d3
Fix broken indexing
Aug 11, 2021
ad18bce
Update mfe urls
Aug 11, 2021
e4c022b
Merge branch 'master' into KristinAoki/TNL-8511
Aug 12, 2021
0199c9e
Restore file to match master
Aug 12, 2021
8ebd3ed
Remove unused code
Aug 12, 2021
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
11 changes: 11 additions & 0 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2453,6 +2453,17 @@
SHOW_ACTIVATE_CTA_POPUP_COOKIE_NAME = 'show-account-activation-popup'
SHOW_ACCOUNT_ACTIVATION_CTA = False

############# Shorten MFE URL ##########################
# .. toggle_name: enable_short_mfe_url
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Flag would be used to hash block_ids and shorten the MFE url
# .. toggle_use_cases: temporary
# .. toggle_tickets: https://github.com/edx/edx-platform/pull/28174/
# .. toggle_creation_date: 2021-08-03
# .. toggle_target_removal_date: 2022-01-01
ENABLE_SHORT_MFE_URL = False

Comment on lines +2456 to +2466
Copy link
Member

Choose a reason for hiding this comment

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

do we still need the CMS setting, or can we drop this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure, when I didn't have it before some of the cms tests failed, but that was also before I refactored the code.

################# Documentation links for course apps #################

# pylint: disable=line-too-long
Expand Down
13 changes: 12 additions & 1 deletion lms/djangoapps/course_api/blocks/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
CourseBlocks API views
"""


from django.core.exceptions import ValidationError
from django.db import transaction
from django.http import Http404
Expand All @@ -14,6 +13,7 @@
from rest_framework.response import Response

from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, view_auth_classes
from openedx.features.course_experience.url_helpers import get_usage_key_hash
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError

Expand Down Expand Up @@ -240,6 +240,17 @@ def list(self, request, usage_key_string, hide_access_denials=False): # pylint:
# case we add the usual caching headers to the response.
if params.cleaned_data.get('username', None) == '':
patch_response_headers(response)

if 'blocks' in response.data:
blocks = response.data['blocks']
else:
blocks = response.data

for block in blocks:
current_block = block
if isinstance(blocks, dict):
current_block = blocks[block]
current_block['hash_key'] = get_usage_key_hash(current_block['id'])
return response
except ItemNotFoundError as exception:
raise Http404(f"Block not found: {str(exception)}") # lint-amnesty, pylint: disable=raise-missing-from
Expand Down
4 changes: 4 additions & 0 deletions lms/djangoapps/course_home_api/outline/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

from django.utils.translation import ngettext
from django.conf import settings
Copy link
Member

Choose a reason for hiding this comment

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

Am I correct that you're adding the hash_key to the URLs here so that the course outline can use them in their links?

If so, you might want to leave those links unchanged for now, and leave the course_home_api as-is. The old links should be fine to stay on the outline page for now, as they'll redirect to the new ones.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that is why I am adding them. Not 100%.

from rest_framework import serializers

from lms.djangoapps.course_home_api.dates.v1.serializers import DateSummarySerializer
Expand All @@ -27,6 +28,7 @@ def get_blocks(self, block):
icon = None
num_graded_problems = block.get('num_graded_problems', 0)
scored = block.get('scored')
hash_key = block['hash_key']

if num_graded_problems and block_type == 'sequential':
questions = ngettext('({number} Question)', '({number} Questions)', num_graded_problems)
Expand Down Expand Up @@ -55,6 +57,7 @@ def get_blocks(self, block):
'resume_block': block.get('resume_block', False),
'type': block_type,
'has_scheduled_content': block.get('has_scheduled_content'),
'hash_key': hash_key,
},
}
for child in children:
Expand Down Expand Up @@ -128,3 +131,4 @@ class OutlineTabSerializer(DatesBannerSerializerMixin, VerifiedModeSerializerMix
resume_course = ResumeCourseSerializer()
welcome_message_html = serializers.CharField()
user_has_passing_grade = serializers.BooleanField()
mfe_short_url_is_active = serializers.BooleanField()
8 changes: 6 additions & 2 deletions lms/djangoapps/course_home_api/outline/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
dismiss_current_update_for_user,
get_current_update_for_user
)
from openedx.features.course_experience.url_helpers import get_learning_mfe_home_url
from openedx.features.course_experience.url_helpers import get_learning_mfe_home_url, get_usage_key_hash
from openedx.features.course_experience.utils import get_course_outline_block_tree, get_start_block
from openedx.features.discounts.utils import generate_offer_data
from xmodule.course_module import COURSE_VISIBILITY_PUBLIC, COURSE_VISIBILITY_PUBLIC_OUTLINE
Expand Down Expand Up @@ -108,6 +108,7 @@ class OutlineTabView(RetrieveAPIView):
the child blocks.
resume_block: (bool) Whether the block is the resume block
has_scheduled_content: (bool) Whether the block has more content scheduled for the future
hash_key: (str) The blake2b hash of the usage ID of the block.
course_goals:
selected_goal:
days_per_week: (int) The number of days the learner wants to learn per week
Expand Down Expand Up @@ -152,6 +153,8 @@ class OutlineTabView(RetrieveAPIView):
url: (str) The display name of the course block to resume
welcome_message_html: (str) Raw HTML for the course updates banner
user_has_passing_grade: (bool) Whether the user currently is passing the course
mfe_short_url_is_active: Flag for the learning mfe on whether or not
the url will contain the block id or hash key.

**Returns**

Expand Down Expand Up @@ -237,6 +240,7 @@ def get(self, request, *args, **kwargs):
is_enrolled = enrollment and enrollment.is_active
is_staff = bool(has_access(request.user, 'staff', course_key))
show_enrolled = is_enrolled or is_staff
mfe_short_url_is_active = settings.ENABLE_SHORT_MFE_URL
if show_enrolled:
course_blocks = get_course_outline_block_tree(request, course_key_string, request.user)
date_blocks = get_course_date_blocks(course, request.user, request, num_assignments=1)
Expand Down Expand Up @@ -318,7 +322,6 @@ def get(self, request, *args, **kwargs):
course_key, request.user, datetime.now(tz=timezone.utc)
)
available_seq_ids = {str(usage_key) for usage_key in user_course_outline.sequences}

# course_blocks is a reference to the root of the course, so we go
# through the chapters (sections) to look for sequences to remove.
for chapter_data in course_blocks['children']:
Expand Down Expand Up @@ -355,6 +358,7 @@ def get(self, request, *args, **kwargs):
'resume_course': resume_course,
'user_has_passing_grade': user_has_passing_grade,
'welcome_message_html': welcome_message_html,
'mfe_short_url_is_active': mfe_short_url_is_active,
}
context = self.get_serializer_context()
context['course_overview'] = course_overview
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/courseware/tests/test_date_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ def test_dates_tab_link_render(self, url_name, legacy_active):
if legacy_active:
html_elements.append('/courses/' + str(course.id) + '/dates')
else:
html_elements.append('/course/' + str(course.id) + '/dates')
html_elements.append('/c/' + str(course.id) + '/dates')
url = reverse(url_name, args=(course.id,))

def assert_html_elements(assert_function, user):
Expand Down
102 changes: 74 additions & 28 deletions lms/djangoapps/courseware/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
get_courseware_url,
make_learning_mfe_courseware_url,
ExperienceOption,
get_usage_key_hash,
)
from openedx.features.enterprise_support.tests.mixins.enterprise import EnterpriseTestConsentRequired
from common.djangoapps.student.models import CourseEnrollment
Expand Down Expand Up @@ -161,7 +162,11 @@ def test_jump_to_legacy_vs_mfe(self, activate_mfe, experience_param, expect_mfe)
chapter = ItemFactory.create(category='chapter', parent_location=course.location)
querystring = f"experience={experience_param}" if experience_param else ""
if expect_mfe:
expected_url = f'http://learning-mfe/course/{course.id}/{chapter.location}'
if settings.ENABLE_SHORT_MFE_URL:
expected_url = f'http://learning-mfe/c/{course.id}/{get_usage_key_hash(chapter.location)}'

else:
expected_url = f'http://learning-mfe/c/{course.id}/{chapter.location}'
else:
expected_url = f'/courses/{course.id}/courseware/{chapter.url_name}/'

Expand Down Expand Up @@ -191,7 +196,7 @@ def test_jump_to_invalid_location(self, activate_mfe, store_type):
course = CourseFactory.create()
location = course.id.make_usage_key(None, 'NoSuchPlace')
expected_redirect_url = (
f'http://learning-mfe/course/{course.id}'
f'http://learning-mfe/c/{course.id}'
) if activate_mfe else (
f'/courses/{course.id}/courseware?' + urlencode({'activate_block_id': str(course.location)})
)
Expand Down Expand Up @@ -224,8 +229,12 @@ def test_jump_to_mfe_from_sequence(self):
chapter = ItemFactory.create(category='chapter', parent_location=course.location)
sequence = ItemFactory.create(category='sequential', parent_location=chapter.location)
expected_redirect_url = (
f'http://learning-mfe/course/{course.id}/{sequence.location}'
f'http://learning-mfe/c/{course.id}/{sequence.location}'
)
if settings.ENABLE_SHORT_MFE_URL:
expected_redirect_url = (
f'http://learning-mfe/c/{course.id}/{get_usage_key_hash(sequence.location)}'
)
jumpto_url = f'/courses/{course.id}/jump_to/{sequence.location}'
response = self.client.get(jumpto_url)
assert response.status_code == 302
Expand Down Expand Up @@ -270,16 +279,26 @@ def test_jump_to_mfe_from_module(self):
module2 = ItemFactory.create(category='html', parent_location=vertical2.location)

expected_redirect_url = (
f'http://learning-mfe/course/{course.id}/{sequence.location}/{vertical1.location}'
f'http://learning-mfe/c/{course.id}/{sequence.location}/{vertical1.location}'
)
if settings.ENABLE_SHORT_MFE_URL:
expected_redirect_url = (
f'http://learning-mfe/c/{course.id}/{get_usage_key_hash(sequence.location)}'
f'/{get_usage_key_hash(vertical1.location)}'
)
jumpto_url = f'/courses/{course.id}/jump_to/{module1.location}'
response = self.client.get(jumpto_url)
assert response.status_code == 302
assert response.url == expected_redirect_url

expected_redirect_url = (
f'http://learning-mfe/course/{course.id}/{sequence.location}/{vertical2.location}'
f'http://learning-mfe/c/{course.id}/{sequence.location}/{vertical2.location}'
)
if settings.ENABLE_SHORT_MFE_URL:
expected_redirect_url = (
f'http://learning-mfe/c/{course.id}/{get_usage_key_hash(sequence.location)}'
f'/{get_usage_key_hash(vertical2.location)}'
)
jumpto_url = f'/courses/{course.id}/jump_to/{module2.location}'
response = self.client.get(jumpto_url)
assert response.status_code == 302
Expand Down Expand Up @@ -489,14 +508,19 @@ def _get_urls(self): # lint-amnesty, pylint: disable=missing-function-docstring
'section': str(self.section2.location.block_id),
}
)
mfe_url = '{}/course/{}/{}'.format(
mfe_url = '{}/c/{}/{}'.format(
settings.LEARNING_MICROFRONTEND_URL,
self.course_key,
self.section2.location
)
short_mfe_url = '{}/c/{}/{}'.format(
settings.LEARNING_MICROFRONTEND_URL,
self.course_key,
get_usage_key_hash(self.section2.location)
)
preview_url = "http://" + settings.FEATURES.get('PREVIEW_LMS_BASE') + lms_url

return lms_url, mfe_url, preview_url
return lms_url, mfe_url, short_mfe_url, preview_url


@ddt.ddt
Expand Down Expand Up @@ -3505,21 +3529,40 @@ def test_url_generation(self):
course_key = CourseKey.from_string("course-v1:OpenEdX+MFE+2020")
section_key = UsageKey.from_string("block-v1:OpenEdX+MFE+2020+type@sequential+block@Introduction")
unit_id = "block-v1:OpenEdX+MFE+2020+type@vertical+block@Getting_To_Know_You"
assert make_learning_mfe_courseware_url(course_key) == (
'https://learningmfe.openedx.org'
'/course/course-v1:OpenEdX+MFE+2020'
)
assert make_learning_mfe_courseware_url(course_key, section_key, '') == (
'https://learningmfe.openedx.org'
'/course/course-v1:OpenEdX+MFE+2020'
'/block-v1:OpenEdX+MFE+2020+type@sequential+block@Introduction'
)
assert make_learning_mfe_courseware_url(course_key, section_key, unit_id) == (
'https://learningmfe.openedx.org'
'/course/course-v1:OpenEdX+MFE+2020'
'/block-v1:OpenEdX+MFE+2020+type@sequential+block@Introduction'
'/block-v1:OpenEdX+MFE+2020+type@vertical+block@Getting_To_Know_You'
)
if settings.ENABLE_SHORT_MFE_URL:
short_section_key = get_usage_key_hash(section_key)
short_unit_id = get_usage_key_hash(unit_id)
assert make_learning_mfe_courseware_url(course_key) == (
'https://learningmfe.openedx.org'
'/c/course-v1:OpenEdX+MFE+2020'
)
assert make_learning_mfe_courseware_url(course_key, short_section_key, '') == (
'https://learningmfe.openedx.org'
'/c/course-v1:OpenEdX+MFE+2020'
'/YmJiOTNjMGJiYTQ2'
)
assert make_learning_mfe_courseware_url(course_key, short_section_key, short_unit_id) == (
'https://learningmfe.openedx.org'
'/c/course-v1:OpenEdX+MFE+2020'
'/YmJiOTNjMGJiYTQ2'
'/MzI4ODU4MjY5YzVi'
)
else:
assert make_learning_mfe_courseware_url(course_key) == (
'https://learningmfe.openedx.org'
'/c/course-v1:OpenEdX+MFE+2020'
)
assert make_learning_mfe_courseware_url(course_key, section_key, '') == (
'https://learningmfe.openedx.org'
'/c/course-v1:OpenEdX+MFE+2020'
'/block-v1:OpenEdX+MFE+2020+type@sequential+block@Introduction'
)
assert make_learning_mfe_courseware_url(course_key, section_key, unit_id) == (
'https://learningmfe.openedx.org'
'/c/course-v1:OpenEdX+MFE+2020'
'/block-v1:OpenEdX+MFE+2020+type@sequential+block@Introduction'
'/block-v1:OpenEdX+MFE+2020+type@vertical+block@Getting_To_Know_You'
)


@ddt.ddt
Expand All @@ -3528,12 +3571,15 @@ class MFERedirectTests(BaseViewsTestCase): # lint-amnesty, pylint: disable=miss

def test_learner_redirect(self):
# learners will be redirected when the waffle flag is set
lms_url, mfe_url, __ = self._get_urls()
lms_url, mfe_url, short_mfe_url, __ = self._get_urls()

assert self.client.get(lms_url).url == mfe_url
if settings.ENABLE_SHORT_MFE_URL:
assert self.client.get(lms_url).url == short_mfe_url
else:
assert self.client.get(lms_url).url == mfe_url

def test_staff_no_redirect(self):
lms_url, __, __ = self._get_urls()
lms_url, __, __, __ = self._get_urls()

# course staff will redirect in an MFE-enabled course - and not redirect otherwise.
course_staff = UserFactory.create(is_staff=False)
Expand All @@ -3556,7 +3602,7 @@ def test_exam_no_redirect(self):
self.section2.is_time_limited = True
self.store.update_item(self.section2, self.user.id)

lms_url, __, __ = self._get_urls()
lms_url, __, __, __ = self._get_urls()

assert self.client.get(lms_url).status_code == 200

Expand All @@ -3574,7 +3620,7 @@ class PreviewRedirectTests(BaseViewsTestCase):
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE

def test_staff_no_redirect(self):
__, __, preview_url = self._get_urls()
__, __, __, preview_url = self._get_urls()
with patch.object(access_utils, 'get_current_request_hostname',
return_value=settings.FEATURES.get('PREVIEW_LMS_BASE', None)):

Expand All @@ -3598,7 +3644,7 @@ def test_exam_no_redirect(self):
self.section2.is_time_limited = True
self.store.update_item(self.section2, self.user.id)

__, __, preview_url = self._get_urls()
__, __, __, preview_url = self._get_urls()

assert self.client.get(preview_url).status_code == 200

Expand Down
1 change: 1 addition & 0 deletions lms/djangoapps/courseware/views/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def microfrontend_url(self):
unit_key = None
except InvalidKeyError:
unit_key = None

url = make_learning_mfe_courseware_url(
self.course_key,
self.section.location if self.section else None,
Expand Down
11 changes: 11 additions & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4788,6 +4788,17 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring
# Token for " Disable Different Origin Subframe Dialog Suppression" for http://localhost:18000
CHROME_DISABLE_SUBFRAME_DIALOG_SUPPRESSION_TOKEN = 'ArNBN7d1AkvMhJTGWXlJ8td/AN4lOokzOnqKRNkTnLqaqx0HpfYvmx8JePPs/emKh6O5fckx14LeZIGJ1AQYjgAAAABzeyJvcmlnaW4iOiJodHRwOi8vbG9jYWxob3N0OjE4MDAwIiwiZmVhdHVyZSI6IkRpc2FibGVEaWZmZXJlbnRPcmlnaW5TdWJmcmFtZURpYWxvZ1N1cHByZXNzaW9uIiwiZXhwaXJ5IjoxNjM5NTI2Mzk5fQ==' # pylint: disable=line-too-long

############# Shorten MFE URL ##########################
# .. toggle_name: enable_short_mfe_url
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Flag would be used to hash block_ids and shorten the MFE url
# .. toggle_use_cases: temporary
# .. toggle_tickets: https://github.com/edx/edx-platform/pull/28174/
# .. toggle_creation_date: 2021-08-03
# .. toggle_target_removal_date: 2022-01-01
ENABLE_SHORT_MFE_URL = False

################# Documentation links for course apps #################

# pylint: disable=line-too-long
Expand Down
9 changes: 9 additions & 0 deletions openedx/core/djangoapps/content/learning_sequences/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ class CourseLearningSequenceData:
learning sequences in Courses vs. Pathways vs. Libraries. Such an object
would likely not have `visibility` as that holds course-specific concepts.
"""

Copy link
Member

Choose a reason for hiding this comment

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

The changes to this file can be replaced with the model persistence in my PR

mapping = {}

def short_id_mapping(self, hash_key, *args, **kwargs):
usage_key_id = kwargs.get('usage_key', None)
if usage_key_id is None:
return self.mapping[hash_key]
self.mapping[hash_key] = usage_key_id

usage_key = attr.ib(type=UsageKey)
title = attr.ib(type=str)
visibility = attr.ib(type=VisibilityData, default=VisibilityData())
Expand Down
1 change: 1 addition & 0 deletions openedx/core/djangoapps/courseware_api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class CourseInfoSerializer(serializers.Serializer): # pylint: disable=abstract-
is_mfe_special_exams_enabled = serializers.BooleanField()
is_mfe_proctored_exams_enabled = serializers.BooleanField()
user_needs_integrity_signature = serializers.BooleanField()
mfe_short_url_is_active = serializers.BooleanField()

def __init__(self, *args, **kwargs):
"""
Expand Down
Loading