diff --git a/lms/djangoapps/course_api/blocks/api.py b/lms/djangoapps/course_api/blocks/api.py index 7c14dfd4c3..95e6c73e98 100644 --- a/lms/djangoapps/course_api/blocks/api.py +++ b/lms/djangoapps/course_api/blocks/api.py @@ -90,6 +90,8 @@ def get_blocks( ), HiddenContentTransformer() ] + else: + transformers += [course_blocks_api.visibility.VisibilityTransformer()] # Note: A change to the BlockCompletionTransformer (https://github.com/edx/edx-platform/pull/27622/) # will be introducing a bug if hide_access_denials is True. I'm accepting this risk because in diff --git a/lms/djangoapps/course_api/blocks/tests/test_api.py b/lms/djangoapps/course_api/blocks/tests/test_api.py index 6ae491ea30..8bf7b9d518 100644 --- a/lms/djangoapps/course_api/blocks/tests/test_api.py +++ b/lms/djangoapps/course_api/blocks/tests/test_api.py @@ -53,7 +53,9 @@ class TestGetBlocks(SharedModuleStoreTestCase): def test_no_user(self): blocks = get_blocks(self.request, self.course.location) - assert str(self.html_block.location) in blocks['blocks'] + assert str(self.html_block.location) not in blocks['blocks'] + vertical_block = self.store.get_item(self.course.id.make_usage_key('vertical', 'vertical_x1a')) + assert str(vertical_block.location) in blocks['blocks'] def test_access_before_api_transformer_order(self): """