Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions lms/djangoapps/course_api/blocks/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(
SupportedFieldType('has_scheduled_content'),
SupportedFieldType('weight'),
SupportedFieldType('show_correctness'),
SupportedFieldType('hide_from_toc'),
# 'student_view_data'
SupportedFieldType(StudentViewTransformer.STUDENT_VIEW_DATA, StudentViewTransformer),
# 'student_view_multi_device'
Expand Down
1 change: 1 addition & 0 deletions lms/djangoapps/course_home_api/outline/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def get_blocks(self, block): # pylint: disable=missing-function-docstring
'resume_block': block.get('resume_block', False),
'type': block_type,
'has_scheduled_content': block.get('has_scheduled_content'),
'hide_from_toc': block.get('hide_from_toc'),
},
}
for child in children:
Expand Down
10 changes: 10 additions & 0 deletions lms/djangoapps/course_home_api/outline/tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,16 @@ def test_user_has_passing_grade(self):
assert response.status_code == 200
assert response.data['user_has_passing_grade'] is True

def test_hide_from_toc_field(self):
"""
Test that the hide_from_toc field is returned in the response.
"""
CourseEnrollment.enroll(self.user, self.course.id)
response = self.client.get(self.url)
assert response.status_code == 200
for block in response.data["course_blocks"]["blocks"].values():
assert "hide_from_toc" in block

def assert_can_enroll(self, can_enroll):
response = self.client.get(self.url)
assert response.status_code == 200
Expand Down
1 change: 1 addition & 0 deletions openedx/features/course_experience/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def recurse_mark_auth_denial(block):
'completion',
'complete',
'resume_block',
'hide_from_toc',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this change necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If the field is not added to the requested_fields list, the field is returned null

],
allow_start_dates_in_future=allow_start_dates_in_future,
)
Expand Down