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
20 changes: 2 additions & 18 deletions cms/djangoapps/contentstore/asset_storage_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from opaque_keys.edx.keys import AssetKey, CourseKey
from pymongo import ASCENDING, DESCENDING

from common.djangoapps.edxmako.shortcuts import render_to_response
from common.djangoapps.student.auth import has_course_author_access
from common.djangoapps.util.date_utils import get_default_time_display
from common.djangoapps.util.json_request import JsonResponse
Expand All @@ -34,8 +33,7 @@
from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order

from .exceptions import AssetNotFoundException, AssetSizeTooLargeException
from .utils import reverse_course_url, get_files_uploads_url, get_response_format, request_response_format_is_json
from .toggles import use_new_files_uploads_page
from .utils import get_files_uploads_url, get_response_format, request_response_format_is_json


REQUEST_DEFAULTS = {
Expand Down Expand Up @@ -169,22 +167,8 @@ def _get_asset_usage_path(course_key, assets):
def _asset_index(request, course_key):
'''
Display an editable asset library.

Supports start (0-based index into the list of assets) and max query parameters.
'''
course_block = modulestore().get_course(course_key)

if use_new_files_uploads_page(course_key):
return redirect(get_files_uploads_url(course_key))

return render_to_response('asset_index.html', {
'language_code': request.LANGUAGE_CODE,
'context_course': course_block,
'max_file_size_in_mbs': settings.MAX_ASSET_UPLOAD_FILE_SIZE_IN_MB,
'chunk_size_in_mbs': settings.UPLOAD_CHUNK_SIZE_IN_MB,
'max_file_size_redirect_url': settings.MAX_ASSET_UPLOAD_FILE_SIZE_URL,
'asset_callback_url': reverse_course_url('assets_handler', course_key)
})
return redirect(get_files_uploads_url(course_key))


def _assets_json(request, course_key):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ def get_use_new_export_page(self, obj):
def get_use_new_files_uploads_page(self, obj):
"""
Method to get the use_new_files_uploads_page switch

Always true, because the switch is being removed an the new experience
should alawys be on.
"""
course_key = self.get_course_key()
return toggles.use_new_files_uploads_page(course_key)
return True

def get_use_new_video_uploads_page(self, obj):
"""
Expand Down
2 changes: 0 additions & 2 deletions cms/djangoapps/contentstore/tests/test_contentstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1491,8 +1491,6 @@ def test_get_html(handler):
test_get_html('course_team_handler')
with override_waffle_flag(toggles.LEGACY_STUDIO_UPDATES, True):
test_get_html('course_info_handler')
with override_waffle_flag(toggles.LEGACY_STUDIO_FILES_UPLOADS, True):
test_get_html('assets_handler')
with override_waffle_flag(toggles.LEGACY_STUDIO_CUSTOM_PAGES, True):
test_get_html('tabs_handler')
with override_waffle_flag(toggles.LEGACY_STUDIO_SCHEDULE_DETAILS, True):
Expand Down
2 changes: 0 additions & 2 deletions cms/djangoapps/contentstore/tests/test_course_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ def test_discussion_fields_available(self, is_pages_and_resources_enabled,
@override_waffle_flag(toggles.LEGACY_STUDIO_EXPORT, True)
@override_waffle_flag(toggles.LEGACY_STUDIO_COURSE_TEAM, True)
@override_waffle_flag(toggles.LEGACY_STUDIO_UPDATES, True)
@override_waffle_flag(toggles.LEGACY_STUDIO_FILES_UPLOADS, True)
@override_waffle_flag(toggles.LEGACY_STUDIO_CUSTOM_PAGES, True)
@override_waffle_flag(toggles.LEGACY_STUDIO_SCHEDULE_DETAILS, True)
@override_waffle_flag(toggles.LEGACY_STUDIO_GRADING, True)
Expand All @@ -188,7 +187,6 @@ def test_disable_advanced_settings_feature(self, disable_advanced_settings):
'export_handler',
'course_team_handler',
'course_info_handler',
'assets_handler',
'tabs_handler',
'settings_handler',
'grading_handler',
Expand Down
19 changes: 0 additions & 19 deletions cms/djangoapps/contentstore/toggles.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,25 +313,6 @@ def use_new_export_page(course_key):
return not LEGACY_STUDIO_EXPORT.is_enabled(course_key)


# .. toggle_name: legacy_studio.files_uploads
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
# .. toggle_description: Temporarily fall back to the old Studio Files & Uploads page.
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2025-03-14
# .. toggle_target_removal_date: 2025-09-14
# .. toggle_tickets: https://github.com/openedx/edx-platform/issues/36275
# .. toggle_warning: In Ulmo, this toggle will be removed. Only the new (React-based) experience will be available.
LEGACY_STUDIO_FILES_UPLOADS = CourseWaffleFlag('legacy_studio.files_uploads', __name__)


def use_new_files_uploads_page(course_key):
"""
Returns a boolean if new studio files and uploads mfe is enabled
"""
return not LEGACY_STUDIO_FILES_UPLOADS.is_enabled(course_key)


# .. toggle_name: contentstore.new_studio_mfe.use_new_video_uploads_page
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
Expand Down
10 changes: 4 additions & 6 deletions cms/djangoapps/contentstore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
use_new_course_team_page,
use_new_custom_pages,
use_new_export_page,
use_new_files_uploads_page,
use_new_grading_page,
use_new_group_configurations_page,
use_new_import_page,
Expand Down Expand Up @@ -416,11 +415,10 @@ def get_files_uploads_url(course_locator) -> str:
Gets course authoring microfrontend URL for files and uploads page view.
"""
files_uploads_url = None
if use_new_files_uploads_page(course_locator):
mfe_base_url = get_course_authoring_url(course_locator)
course_mfe_url = f'{mfe_base_url}/course/{course_locator}/assets'
if mfe_base_url:
files_uploads_url = course_mfe_url
mfe_base_url = get_course_authoring_url(course_locator)
course_mfe_url = f'{mfe_base_url}/course/{course_locator}/assets'
if mfe_base_url:
files_uploads_url = course_mfe_url
return files_uploads_url


Expand Down
5 changes: 1 addition & 4 deletions cms/djangoapps/contentstore/views/tests/test_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
from ddt import data, ddt
from django.conf import settings
from django.test.utils import override_settings
from edx_toggles.toggles.testutils import override_waffle_flag
from opaque_keys.edx.keys import AssetKey
from opaque_keys.edx.locator import CourseLocator
from PIL import Image
from pytz import UTC

from cms.djangoapps.contentstore import toggles
from cms.djangoapps.contentstore.tests.utils import CourseTestCase
from cms.djangoapps.contentstore.utils import reverse_course_url
from cms.djangoapps.contentstore.views import assets
Expand Down Expand Up @@ -87,10 +85,9 @@ class BasicAssetsTestCase(AssetsTestCase):
Test getting assets via html w/o additional args
"""

@override_waffle_flag(toggles.LEGACY_STUDIO_FILES_UPLOADS, True)
def test_basic(self):
resp = self.client.get(self.url, HTTP_ACCEPT='text/html')
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.status_code, 302)

def test_static_url_generation(self):

Expand Down
59 changes: 0 additions & 59 deletions cms/templates/asset_index.html

This file was deleted.

8 changes: 0 additions & 8 deletions cms/templates/widgets/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ <h1 class="branding">
checklists_url = reverse('checklists_handler', kwargs={'course_key_string': str(course_key)})
pages_and_resources_mfe_enabled = ENABLE_PAGES_AND_RESOURCES_MICROFRONTEND.is_enabled(context_course.id)
updates_mfe_enabled = toggles.use_new_updates_page(context_course.id)
files_uploads_mfe_enabled = toggles.use_new_files_uploads_page(context_course.id)
video_upload_mfe_enabled = toggles.use_new_video_uploads_page(context_course.id)
schedule_details_mfe_enabled = toggles.use_new_schedule_details_page(context_course.id)
grading_mfe_enabled = toggles.use_new_grading_page(context_course.id)
Expand Down Expand Up @@ -104,16 +103,9 @@ <h3 class="title"><span class="label"><span class="label-prefix sr">${_("Course"
<a href="${get_pages_and_resources_url(course_key)}">${_("Pages & Resources")}</a>
</li>
% endif
%if not files_uploads_mfe_enabled:
<li class="nav-item nav-course-courseware-uploads">
<a href="${assets_url}">${_("Files")}</a>
</li>
%endif
%if files_uploads_mfe_enabled:
<li class="nav-item nav-course-courseware-uploads">
<a href="${get_files_uploads_url(course_key)}">${_("Files")}</a>
</li>
%endif
% if not pages_and_resources_mfe_enabled:
<li class="nav-item nav-course-courseware-textbooks">
<a href="${textbooks_url}">${_("Textbooks")}</a>
Expand Down
Loading