Hide empty container blocks from the course blocks api when called by the mobile app
All code in this PR should be removed after REVE-52 is merged and mobile traffic from older app versions falls to < 5% of the mobile traffic to the course_blocks api
This commit is contained in:
@@ -4,7 +4,9 @@ API function for retrieving course blocks data
|
||||
|
||||
import lms.djangoapps.course_blocks.api as course_blocks_api
|
||||
from lms.djangoapps.course_blocks.transformers.hidden_content import HiddenContentTransformer
|
||||
from lms.djangoapps.course_blocks.transformers.hide_empty import HideEmptyTransformer
|
||||
from openedx.core.djangoapps.content.block_structure.transformers import BlockStructureTransformers
|
||||
from openedx.core.lib.mobile_utils import is_request_from_mobile_app
|
||||
|
||||
from .serializers import BlockDictSerializer, BlockSerializer
|
||||
from .transformers.blocks_api import BlocksAPITransformer
|
||||
@@ -60,10 +62,18 @@ def get_blocks(
|
||||
|
||||
if user is not None:
|
||||
transformers += course_blocks_api.get_course_block_access_transformers(user)
|
||||
transformers += [MilestonesAndSpecialExamsTransformer(
|
||||
include_special_exams=include_special_exams,
|
||||
include_gated_sections=include_gated_sections)]
|
||||
transformers += [HiddenContentTransformer()]
|
||||
transformers += [
|
||||
MilestonesAndSpecialExamsTransformer(
|
||||
include_special_exams=include_special_exams,
|
||||
include_gated_sections=include_gated_sections
|
||||
),
|
||||
HiddenContentTransformer()
|
||||
]
|
||||
|
||||
# TODO: Remove this after REVE-52 lands and old-mobile-app traffic falls to < 5% of mobile traffic
|
||||
if is_request_from_mobile_app(request):
|
||||
transformers += [HideEmptyTransformer()]
|
||||
|
||||
transformers += [
|
||||
BlocksAPITransformer(
|
||||
block_counts,
|
||||
|
||||
Reference in New Issue
Block a user