feat!: Remove outdated Libraries Relaunch cruft (#35644)
The V2 libraries project had a few past iterations which were never launched. This commit cleans up pieces from those which we don't need for the real Libraries Relaunch MVP in Sumac: * Remove ENABLE_LIBRARY_AUTHORING_MICROFRONTEND, LIBRARY_AUTHORING_FRONTEND_URL, and REDIRECT_TO_LIBRARY_AUTHORING_MICROFRONTEND, all of which are obsolete now that library authoring has been merged into https://github.com/openedx/frontend-app-authoring. More details on the new Content Libraries configuration settings are here: https://github.com/openedx/frontend-app-authoring/issues/1334 * Remove dangling support for syncing V2 (learning core-backed) library content using the LibraryContentBlock. This code was all based on an older understanding of V2 Content Libraries, where the libraries were smaller and versioned as a whole rather then versioned by-item. Reference to V2 libraries will be done on a per-block basis using the upstream/downstream system, described here: https://github.com/openedx/edx-platform/blob/master/docs/decisions/0020-upstream-downstream.rst It's important that we remove this support now so that OLX course authors don't stuble upon it and use it, which would be buggy and complicate future migrations. * Remove the "mode" parameter from LibraryContentBlock. The only supported mode was and is "random". We will not be adding any further modes. Going forward for V2, we will have an ItemBank block for randomizing items (regardless of source), which can be synthesized with upstream referenced as described above. Existing LibraryContentBlocks will be migrated. * Finally, some renamings: * LibraryContentBlock -> LegacyLibraryContentBlock * LibraryToolsService -> LegacyLibraryToolsService * LibrarySummary -> LegacyLibrarySummary Module names and the old OLX tag (library_content) are unchanged. Closes: https://github.com/openedx/frontend-app-authoring/issues/1115
This commit is contained in:
@@ -4,7 +4,7 @@ waffle switches for the contentstore app.
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleSwitch
|
||||
from edx_toggles.toggles import WaffleSwitch
|
||||
|
||||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
|
||||
|
||||
@@ -26,20 +26,6 @@ SHOW_REVIEW_RULES_FLAG = CourseWaffleFlag( # lint-amnesty, pylint: disable=togg
|
||||
f'{WAFFLE_NAMESPACE}.show_review_rules', __name__, LOG_PREFIX
|
||||
)
|
||||
|
||||
# Waffle flag to redirect to the library authoring MFE.
|
||||
# .. toggle_name: contentstore.library_authoring_mfe
|
||||
# .. toggle_implementation: WaffleFlag
|
||||
# .. toggle_default: False
|
||||
# .. toggle_description: Toggles the new micro-frontend-based implementation of the library authoring experience.
|
||||
# .. toggle_use_cases: temporary, open_edx
|
||||
# .. toggle_creation_date: 2020-08-03
|
||||
# .. toggle_target_removal_date: 2020-12-31
|
||||
# .. toggle_warning: Also set settings.LIBRARY_AUTHORING_MICROFRONTEND_URL and ENABLE_LIBRARY_AUTHORING_MICROFRONTEND.
|
||||
# .. toggle_tickets: https://openedx.atlassian.net/wiki/spaces/OEPM/pages/4106944527/Libraries+Relaunch+Proposal+For+Product+Review
|
||||
REDIRECT_TO_LIBRARY_AUTHORING_MICROFRONTEND = WaffleFlag(
|
||||
f'{WAFFLE_NAMESPACE}.library_authoring_mfe', __name__, LOG_PREFIX
|
||||
)
|
||||
|
||||
|
||||
# .. toggle_name: studio.custom_relative_dates
|
||||
# .. toggle_implementation: CourseWaffleFlag
|
||||
|
||||
@@ -59,10 +59,8 @@ class CourseHomeSerializer(serializers.Serializer):
|
||||
libraries = LibraryViewSerializer(many=True, required=False, allow_null=True)
|
||||
libraries_enabled = serializers.BooleanField()
|
||||
taxonomies_enabled = serializers.BooleanField()
|
||||
library_authoring_mfe_url = serializers.CharField()
|
||||
taxonomy_list_mfe_url = serializers.CharField()
|
||||
optimization_enabled = serializers.BooleanField()
|
||||
redirect_to_library_authoring_mfe = serializers.BooleanField()
|
||||
request_course_creator_url = serializers.CharField()
|
||||
rerun_creator_status = serializers.BooleanField()
|
||||
show_new_library_button = serializers.BooleanField()
|
||||
|
||||
@@ -59,9 +59,7 @@ class HomePageView(APIView):
|
||||
"in_process_course_actions": [],
|
||||
"libraries": [],
|
||||
"libraries_enabled": true,
|
||||
"library_authoring_mfe_url": "//localhost:3001/course/course-v1:edX+P315+2T2023",
|
||||
"optimization_enabled": true,
|
||||
"redirect_to_library_authoring_mfe": false,
|
||||
"request_course_creator_url": "/request_course_creator",
|
||||
"rerun_creator_status": true,
|
||||
"show_new_library_button": true,
|
||||
|
||||
@@ -52,10 +52,8 @@ class HomePageViewTest(CourseTestCase):
|
||||
"libraries": [],
|
||||
"libraries_enabled": True,
|
||||
"taxonomies_enabled": True,
|
||||
"library_authoring_mfe_url": settings.LIBRARY_AUTHORING_MICROFRONTEND_URL,
|
||||
"taxonomy_list_mfe_url": 'http://course-authoring-mfe/taxonomies',
|
||||
"optimization_enabled": False,
|
||||
"redirect_to_library_authoring_mfe": False,
|
||||
"request_course_creator_url": "/request_course_creator",
|
||||
"rerun_creator_status": True,
|
||||
"show_new_library_button": True,
|
||||
|
||||
@@ -98,7 +98,7 @@ from cms.djangoapps.contentstore.toggles import (
|
||||
)
|
||||
from cms.djangoapps.models.settings.course_grading import CourseGradingModel
|
||||
from cms.djangoapps.models.settings.course_metadata import CourseMetadata
|
||||
from xmodule.library_tools import LibraryToolsService
|
||||
from xmodule.library_tools import LegacyLibraryToolsService
|
||||
from xmodule.course_block import DEFAULT_START_DATE # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.data import CertificatesDisplayBehaviors
|
||||
from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order
|
||||
@@ -1265,7 +1265,7 @@ def load_services_for_studio(runtime, user):
|
||||
"settings": SettingsService(),
|
||||
"lti-configuration": ConfigurationService(CourseAllowPIISharingInLTIFlag),
|
||||
"teams_configuration": TeamsConfigurationService(),
|
||||
"library_tools": LibraryToolsService(modulestore(), user.id)
|
||||
"library_tools": LegacyLibraryToolsService(modulestore(), user.id)
|
||||
}
|
||||
|
||||
runtime._services.update(services) # lint-amnesty, pylint: disable=protected-access
|
||||
@@ -1671,9 +1671,7 @@ def get_home_context(request, no_course=False):
|
||||
ENABLE_GLOBAL_STAFF_OPTIMIZATION,
|
||||
)
|
||||
from cms.djangoapps.contentstore.views.library import (
|
||||
LIBRARY_AUTHORING_MICROFRONTEND_URL,
|
||||
LIBRARIES_ENABLED,
|
||||
should_redirect_to_library_authoring_mfe,
|
||||
user_can_view_create_library_button,
|
||||
)
|
||||
|
||||
@@ -1699,12 +1697,9 @@ def get_home_context(request, no_course=False):
|
||||
'in_process_course_actions': in_process_course_actions,
|
||||
'libraries_enabled': LIBRARIES_ENABLED,
|
||||
'taxonomies_enabled': not is_tagging_feature_disabled(),
|
||||
'redirect_to_library_authoring_mfe': should_redirect_to_library_authoring_mfe(),
|
||||
'library_authoring_mfe_url': LIBRARY_AUTHORING_MICROFRONTEND_URL,
|
||||
'taxonomy_list_mfe_url': get_taxonomy_list_url(),
|
||||
'libraries': libraries,
|
||||
'show_new_library_button': user_can_view_create_library_button(user)
|
||||
and not should_redirect_to_library_authoring_mfe(),
|
||||
'show_new_library_button': user_can_view_create_library_button(user),
|
||||
'user': user,
|
||||
'request_course_creator_url': reverse('request_course_creator'),
|
||||
'course_creator_status': _get_course_creator_status(user),
|
||||
@@ -2202,7 +2197,7 @@ class StudioPermissionsService:
|
||||
|
||||
Deprecated. To be replaced by a more general authorization service.
|
||||
|
||||
Only used by LibraryContentBlock (and library_tools.py).
|
||||
Only used by LegacyLibraryContentBlock (and library_tools.py).
|
||||
"""
|
||||
|
||||
def __init__(self, user):
|
||||
|
||||
@@ -41,7 +41,6 @@ from common.djangoapps.student.roles import (
|
||||
)
|
||||
from common.djangoapps.util.json_request import JsonResponse, JsonResponseBadRequest, expect_json
|
||||
|
||||
from ..config.waffle import REDIRECT_TO_LIBRARY_AUTHORING_MICROFRONTEND
|
||||
from ..utils import add_instructor, reverse_library_url
|
||||
from .component import CONTAINER_TEMPLATES, get_component_templates
|
||||
from cms.djangoapps.contentstore.xblock_storage_handlers.view_handlers import create_xblock_info
|
||||
@@ -52,21 +51,6 @@ __all__ = ['library_handler', 'manage_library_users']
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
LIBRARIES_ENABLED = settings.FEATURES.get('ENABLE_CONTENT_LIBRARIES', False)
|
||||
ENABLE_LIBRARY_AUTHORING_MICROFRONTEND = settings.FEATURES.get('ENABLE_LIBRARY_AUTHORING_MICROFRONTEND', False)
|
||||
LIBRARY_AUTHORING_MICROFRONTEND_URL = settings.LIBRARY_AUTHORING_MICROFRONTEND_URL
|
||||
|
||||
|
||||
def should_redirect_to_library_authoring_mfe():
|
||||
"""
|
||||
Boolean helper method, returns whether or not to redirect to the Library
|
||||
Authoring MFE based on settings and flags.
|
||||
"""
|
||||
|
||||
return (
|
||||
ENABLE_LIBRARY_AUTHORING_MICROFRONTEND and
|
||||
LIBRARY_AUTHORING_MICROFRONTEND_URL and
|
||||
REDIRECT_TO_LIBRARY_AUTHORING_MICROFRONTEND.is_enabled()
|
||||
)
|
||||
|
||||
|
||||
def _user_can_create_library_for_org(user, org=None):
|
||||
|
||||
@@ -982,7 +982,7 @@ class TestDuplicateItem(ItemTest, DuplicateHelper, OpenEdxEventsTestMixin):
|
||||
|
||||
def test_duplicate_library_content_block(self): # pylint: disable=too-many-statements
|
||||
"""
|
||||
Test the LibraryContentBlock's special duplication process.
|
||||
Test the LegacyLibraryContentBlock's special duplication process.
|
||||
"""
|
||||
store = modulestore()
|
||||
|
||||
|
||||
@@ -7,13 +7,11 @@ import ddt
|
||||
from opaque_keys.edx.keys import UsageKey
|
||||
from rest_framework.test import APIClient
|
||||
from openedx_tagging.core.tagging.models import Tag
|
||||
from organizations.models import Organization
|
||||
from xmodule.modulestore.django import contentstore, modulestore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, upload_file_to_course
|
||||
from xmodule.modulestore.tests.factories import BlockFactory, CourseFactory, ToyCourseFactory
|
||||
from xmodule.modulestore.tests.factories import BlockFactory, CourseFactory, ToyCourseFactory, LibraryFactory
|
||||
|
||||
from cms.djangoapps.contentstore.utils import reverse_usage_url
|
||||
from openedx.core.djangoapps.content_libraries import api as library_api
|
||||
from openedx.core.djangoapps.content_tagging import api as tagging_api
|
||||
|
||||
CLIPBOARD_ENDPOINT = "/api/content-staging/v1/clipboard/"
|
||||
@@ -165,12 +163,12 @@ class ClipboardPasteTestCase(ModuleStoreTestCase):
|
||||
publish_item=True,
|
||||
).location
|
||||
|
||||
library = ClipboardLibraryContentPasteTestCase.setup_library()
|
||||
library = ClipboardPasteFromV1LibraryTestCase.setup_library()
|
||||
with self.store.bulk_operations(course_key):
|
||||
library_content_block_key = BlockFactory.create(
|
||||
parent=self.store.get_item(unit_key),
|
||||
category="library_content",
|
||||
source_library_id=str(library.key),
|
||||
source_library_id=str(library.context_key),
|
||||
display_name="LC Block",
|
||||
publish_item=True,
|
||||
).location
|
||||
@@ -393,27 +391,27 @@ class ClipboardPasteTestCase(ModuleStoreTestCase):
|
||||
assert source_pic2_hash != dest_pic2_hash # Because there was a conflict, this file was unchanged.
|
||||
|
||||
|
||||
class ClipboardLibraryContentPasteTestCase(ModuleStoreTestCase):
|
||||
class ClipboardPasteFromV1LibraryTestCase(ModuleStoreTestCase):
|
||||
"""
|
||||
Test Clipboard Paste functionality with library content
|
||||
Test Clipboard Paste functionality with legacy (v1) library content
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
Set up a v2 Content Library and a library content block
|
||||
Set up a v1 Content Library and a library content block
|
||||
"""
|
||||
super().setUp()
|
||||
self.client = APIClient()
|
||||
self.client.login(username=self.user.username, password=self.user_password)
|
||||
self.store = modulestore()
|
||||
library = self.setup_library()
|
||||
self.library = self.setup_library()
|
||||
|
||||
# Create a library content block (lc), point it out our library, and sync it.
|
||||
self.course = CourseFactory.create(display_name='Course')
|
||||
self.orig_lc_block = BlockFactory.create(
|
||||
parent=self.course,
|
||||
category="library_content",
|
||||
source_library_id=str(library.key),
|
||||
source_library_id=str(self.library.context_key),
|
||||
display_name="LC Block",
|
||||
publish_item=False,
|
||||
)
|
||||
@@ -426,18 +424,15 @@ class ClipboardLibraryContentPasteTestCase(ModuleStoreTestCase):
|
||||
@classmethod
|
||||
def setup_library(cls):
|
||||
"""
|
||||
Creates and returns a content library.
|
||||
Creates and returns a legacy content library with 1 problem
|
||||
"""
|
||||
library = library_api.create_library(
|
||||
library_type=library_api.COMPLEX,
|
||||
org=Organization.objects.create(name="Test Org", short_name="CL-TEST"),
|
||||
slug="lib",
|
||||
title="Library",
|
||||
)
|
||||
# Populate it with a problem:
|
||||
problem_key = library_api.create_library_block(library.key, "problem", "p1").usage_key
|
||||
library_api.set_library_block_olx(problem_key, """
|
||||
<problem display_name="MCQ" max_attempts="1">
|
||||
library = LibraryFactory.create(display_name='Library')
|
||||
lib_block = BlockFactory.create(
|
||||
parent_location=library.usage_key,
|
||||
category="problem",
|
||||
display_name="MCQ",
|
||||
max_attempts=1,
|
||||
data="""
|
||||
<multiplechoiceresponse>
|
||||
<label>Q</label>
|
||||
<choicegroup type="MultipleChoice">
|
||||
@@ -445,9 +440,9 @@ class ClipboardLibraryContentPasteTestCase(ModuleStoreTestCase):
|
||||
<choice correct="true">Right</choice>
|
||||
</choicegroup>
|
||||
</multiplechoiceresponse>
|
||||
</problem>
|
||||
""")
|
||||
library_api.publish_changes(library.key)
|
||||
""",
|
||||
publish_item=False,
|
||||
)
|
||||
return library
|
||||
|
||||
def test_paste_library_content_block(self):
|
||||
|
||||
@@ -434,18 +434,6 @@ FEATURES = {
|
||||
# .. toggle_tickets: https://openedx.atlassian.net/browse/DEPR-58
|
||||
'DEPRECATE_OLD_COURSE_KEYS_IN_STUDIO': True,
|
||||
|
||||
# .. toggle_name: FEATURES['ENABLE_LIBRARY_AUTHORING_MICROFRONTEND']
|
||||
# .. toggle_implementation: DjangoSetting
|
||||
# .. toggle_default: False
|
||||
# .. toggle_description: Set to True to enable the Library Authoring MFE
|
||||
# .. toggle_use_cases: temporary
|
||||
# .. toggle_creation_date: 2020-06-20
|
||||
# .. toggle_target_removal_date: 2020-12-31
|
||||
# .. toggle_tickets: https://openedx.atlassian.net/wiki/spaces/OEPM/pages/4106944527/Libraries+Relaunch+Proposal+For+Product+Review
|
||||
# .. toggle_warning: Also set settings.LIBRARY_AUTHORING_MICROFRONTEND_URL and see
|
||||
# REDIRECT_TO_LIBRARY_AUTHORING_MICROFRONTEND for rollout.
|
||||
'ENABLE_LIBRARY_AUTHORING_MICROFRONTEND': False,
|
||||
|
||||
# .. toggle_name: FEATURES['DISABLE_COURSE_CREATION']
|
||||
# .. toggle_implementation: DjangoSetting
|
||||
# .. toggle_default: False
|
||||
@@ -601,7 +589,6 @@ IDA_LOGOUT_URI_LIST = []
|
||||
COURSE_AUTHORING_MICROFRONTEND_URL = None
|
||||
DISCUSSIONS_MICROFRONTEND_URL = None
|
||||
DISCUSSIONS_MFE_FEEDBACK_URL = None
|
||||
LIBRARY_AUTHORING_MICROFRONTEND_URL = None
|
||||
# .. toggle_name: ENABLE_AUTHN_RESET_PASSWORD_HIBP_POLICY
|
||||
# .. toggle_implementation: DjangoSetting
|
||||
# .. toggle_default: False
|
||||
@@ -2779,6 +2766,7 @@ WIKI_HELP_URL = "https://edx.readthedocs.io/projects/open-edx-building-and-runni
|
||||
CUSTOM_PAGES_HELP_URL = "https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/course_assets/pages.html#adding-custom-pages"
|
||||
COURSE_LIVE_HELP_URL = "https://edx.readthedocs.io/projects/edx-partner-course-staff/en/latest/course_assets/course_live.html"
|
||||
ORA_SETTINGS_HELP_URL = "https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/course_assets/pages.html#configuring-course-level-open-response-assessment-settings"
|
||||
# pylint: enable=line-too-long
|
||||
|
||||
# keys for big blue button live provider
|
||||
COURSE_LIVE_GLOBAL_CREDENTIALS = {}
|
||||
@@ -2810,6 +2798,7 @@ DISCUSSIONS_INCONTEXT_FEEDBACK_URL = ''
|
||||
# Learn More link in upgraded discussion notification alert
|
||||
# pylint: disable=line-too-long
|
||||
DISCUSSIONS_INCONTEXT_LEARNMORE_URL = "https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/manage_discussions/discussions.html"
|
||||
# pylint: enable=line-too-long
|
||||
|
||||
#### django-simple-history##
|
||||
# disable indexing on date field its coming django-simple-history.
|
||||
|
||||
@@ -174,9 +174,6 @@ FEATURES['ENABLE_ORGANIZATION_STAFF_ACCESS_FOR_CONTENT_LIBRARIES'] = True
|
||||
################### FRONTEND APPLICATION PUBLISHER URL ###################
|
||||
FEATURES['FRONTEND_APP_PUBLISHER_URL'] = 'http://localhost:18400'
|
||||
|
||||
################### FRONTEND APPLICATION LIBRARY AUTHORING ###################
|
||||
LIBRARY_AUTHORING_MICROFRONTEND_URL = 'http://localhost:3001'
|
||||
|
||||
################### FRONTEND APPLICATION COURSE AUTHORING ###################
|
||||
COURSE_AUTHORING_MICROFRONTEND_URL = 'http://localhost:2001'
|
||||
|
||||
|
||||
@@ -348,9 +348,6 @@ from openedx.core.djangolib.js_utils import (
|
||||
% endif
|
||||
|
||||
% if libraries_enabled:
|
||||
% if redirect_to_library_authoring_mfe:
|
||||
<li><a href="${library_authoring_mfe_url}">${_("Libraries")}</a></li>
|
||||
%else:
|
||||
<li class="libraries-tab ${ 'active' if active_tab == 'libraries' else ''}">
|
||||
% if split_studio_home:
|
||||
<a href="${reverse('home_library')}">${_("Libraries")}</a>
|
||||
@@ -358,7 +355,6 @@ from openedx.core.djangolib.js_utils import (
|
||||
<a href="#" >${_("Libraries")}</a>
|
||||
% endif
|
||||
</li>
|
||||
% endif
|
||||
% endif
|
||||
% if taxonomies_enabled:
|
||||
<li><a href="${taxonomy_list_mfe_url}">${_("Taxonomies")}</li>
|
||||
|
||||
Reference in New Issue
Block a user