refactor: rename module -> block within lms/djangoapps/courseware

Also, removed unused `_has_access_xmodule` methid from `lms/djangoapps/courseware/access.py`.
This commit is contained in:
0x29a
2022-12-23 15:27:31 +01:00
committed by Agrendalath
parent 611563600c
commit 9d8375ff99
55 changed files with 432 additions and 443 deletions

View File

@@ -12,7 +12,7 @@ from rest_framework.response import Response
from rest_framework.views import APIView
from common.djangoapps.static_replace import make_static_urls_absolute
from lms.djangoapps.courseware.courses import get_course_info_section_module
from lms.djangoapps.courseware.courses import get_course_info_section_block
from lms.djangoapps.course_goals.models import UserActivity
from openedx.core.lib.xblock_utils import get_course_update_items
from openedx.features.course_experience import ENABLE_COURSE_GOALS
@@ -47,7 +47,7 @@ class CourseUpdatesList(generics.ListAPIView):
@mobile_course_access()
def list(self, request, course, *args, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
course_updates_module = get_course_info_section_module(request, request.user, course, 'updates')
course_updates_module = get_course_info_section_block(request, request.user, course, 'updates')
update_items = get_course_update_items(course_updates_module)
updates_to_show = [
@@ -82,7 +82,7 @@ class CourseHandoutsList(generics.ListAPIView):
@mobile_course_access()
def list(self, request, course, *args, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
course_handouts_module = get_course_info_section_module(request, request.user, course, 'handouts')
course_handouts_module = get_course_info_section_block(request, request.user, course, 'handouts')
if course_handouts_module:
if course_handouts_module.data == "<ol></ol>":
handouts_html = None

View File

@@ -25,7 +25,7 @@ from lms.djangoapps.courseware.access import is_mobile_available_for_user
from lms.djangoapps.courseware.access_utils import ACCESS_GRANTED
from lms.djangoapps.courseware.courses import get_current_child
from lms.djangoapps.courseware.model_data import FieldDataCache
from lms.djangoapps.courseware.module_render import get_module_for_descriptor
from lms.djangoapps.courseware.block_render import get_block_for_descriptor
from lms.djangoapps.courseware.views.index import save_positions_recursively_up
from lms.djangoapps.mobile_api.models import MobileConfig
from lms.djangoapps.mobile_api.utils import API_V1, API_V05, API_V2
@@ -143,7 +143,7 @@ class UserCourseStatus(views.APIView):
field_data_cache = FieldDataCache.cache_for_descriptor_descendents(
course.id, request.user, course, depth=2)
course_block = get_module_for_descriptor(
course_block = get_block_for_descriptor(
request.user, request, course, field_data_cache, course.id, course=course
)
@@ -179,7 +179,7 @@ class UserCourseStatus(views.APIView):
module_descriptor = modulestore().get_item(module_key)
except ItemNotFoundError:
return Response(errors.ERROR_INVALID_MODULE_ID, status=400)
module = get_module_for_descriptor(
module = get_block_for_descriptor(
request.user, request, module_descriptor, field_data_cache, course.id, course=course
)