feat!: Drop the legacy studio home page.

This is the page that lists the courses in studio.  This has been
replaced by an MFE and the MFE has been on by default since Teak.

BREAKING CHANGE: Setting the `legacy_studio.home` waffle flag will no longer
work.  The code will behave as if this is set to false showing the new
studio authoring MFE experience for the course home page.

This has been the default since Teak.
This commit is contained in:
Feanil Patel
2025-10-09 13:21:26 -04:00
parent 073afac46a
commit 0077058e37
7 changed files with 27 additions and 69 deletions

View File

@@ -40,9 +40,13 @@ class CourseWaffleFlagsSerializer(serializers.Serializer):
def get_use_new_home_page(self, obj):
"""
Method to get the use_new_home_page switch
Method to indicate whether we should use the new home page.
This used to be based on a waffle flag but the flag is being removed so we
default it to true for now until we can remove the need for it from the consumers
of this serializer and the related APIs.
"""
return toggles.use_new_home_page()
return True
def get_use_new_custom_pages(self, obj):
"""

View File

@@ -8,12 +8,9 @@ from unittest.mock import Mock, patch
import ddt
from ccx_keys.locator import CCXLocator
from django.conf import settings
from django.test import RequestFactory
from edx_toggles.toggles.testutils import override_waffle_flag
from opaque_keys.edx.locations import CourseLocator
from cms.djangoapps.contentstore import toggles
from cms.djangoapps.contentstore.tests.utils import AjaxEnabledTestClient
from cms.djangoapps.contentstore.utils import delete_course
from cms.djangoapps.contentstore.views.course import (
@@ -89,15 +86,6 @@ class TestCourseListing(ModuleStoreTestCase):
self.client.logout()
ModuleStoreTestCase.tearDown(self) # pylint: disable=non-parent-method-called
@override_waffle_flag(toggles.LEGACY_STUDIO_HOME, True)
def test_empty_course_listing(self):
"""
Test on empty course listing, studio name is properly displayed
"""
message = f"Are you staff on an existing {settings.STUDIO_SHORT_NAME} course?"
response = self.client.get('/home')
self.assertContains(response, message)
def test_get_course_list(self):
"""
Test getting courses with new access group format e.g. 'instructor_edx.course.run'

View File

@@ -11,7 +11,7 @@ Part of https://github.com/openedx/edx-platform/issues/36275.
import datetime
import time
from unittest import mock
from urllib.parse import quote_plus
from urllib.parse import quote_plus, unquote
from ddt import data, ddt, unpack
from django.conf import settings
@@ -24,6 +24,7 @@ from pytz import UTC
from cms.djangoapps.contentstore import toggles
from cms.djangoapps.contentstore.tests.test_course_settings import CourseTestCase
from cms.djangoapps.contentstore.tests.utils import AjaxEnabledTestClient, parse_json, registration, user
from cms.djangoapps.contentstore.utils import get_studio_home_url
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, pylint: disable=wrong-import-order
@@ -114,12 +115,6 @@ class AuthTestCase(ContentStoreTestCase):
# clear the cache so ratelimiting won't affect these tests
cache.clear()
def check_page_get(self, url, expected):
resp = self.client.get_html(url)
self.assertEqual(resp.status_code, expected)
return resp
@override_waffle_flag(toggles.LEGACY_STUDIO_HOME, True)
def test_private_pages_auth(self):
"""Make sure pages that do require login work."""
auth_pages = (
@@ -143,7 +138,9 @@ class AuthTestCase(ContentStoreTestCase):
print('Not logged in')
for page in auth_pages:
print(f"Checking '{page}'")
self.check_page_get(page, expected=302)
resp = self.client.get_html(page)
assert resp.status_code == 302
assert resp.url == unquote(reverse("login", query={"next": page}))
# Logged in should work.
self.login(self.email, self.pw)
@@ -151,10 +148,11 @@ class AuthTestCase(ContentStoreTestCase):
print('Logged in')
for page in simple_auth_pages:
print(f"Checking '{page}'")
self.check_page_get(page, expected=200)
resp = self.client.get_html(page)
assert resp.status_code == 302
assert resp.url == get_studio_home_url()
@override_settings(SESSION_INACTIVITY_TIMEOUT_IN_SECONDS=1)
@override_waffle_flag(toggles.LEGACY_STUDIO_HOME, True)
def test_inactive_session_timeout(self):
"""
Verify that an inactive session times out and redirects to the
@@ -168,7 +166,8 @@ class AuthTestCase(ContentStoreTestCase):
# make sure we can access courseware immediately
course_url = '/home/'
resp = self.client.get_html(course_url)
self.assertEqual(resp.status_code, 200)
assert resp.status_code == 302
assert resp.url == get_studio_home_url()
# then wait a bit and see if we get timed out
time.sleep(2)

View File

@@ -162,25 +162,6 @@ def individualize_anonymous_user_id(course_id):
return INDIVIDUALIZE_ANONYMOUS_USER_ID.is_enabled(course_id)
# .. toggle_name: legacy_studio.home
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
# .. toggle_description: Temporarily fall back to the old Studio logged-in landing 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_HOME = WaffleFlag('legacy_studio.home', __name__)
def use_new_home_page():
"""
Returns a boolean if new studio home page mfe is enabled
"""
return not LEGACY_STUDIO_HOME.is_enabled()
# .. toggle_name: legacy_studio.custom_pages
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False

View File

@@ -15,7 +15,7 @@ from uuid import uuid4
from bs4 import BeautifulSoup
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, ValidationError
from django.urls import reverse
from django.utils import translation
from django.utils.text import Truncator
@@ -50,7 +50,6 @@ from cms.djangoapps.contentstore.toggles import (
use_new_files_uploads_page,
use_new_grading_page,
use_new_group_configurations_page,
use_new_home_page,
use_new_import_page,
use_new_schedule_details_page,
use_new_textbooks_page,
@@ -298,12 +297,15 @@ def get_studio_home_url():
"""
Gets course authoring microfrontend URL for Studio Home view.
"""
studio_home_url = None
if use_new_home_page():
mfe_base_url = settings.COURSE_AUTHORING_MICROFRONTEND_URL
if mfe_base_url:
studio_home_url = f'{mfe_base_url}/home'
return studio_home_url
mfe_base_url = settings.COURSE_AUTHORING_MICROFRONTEND_URL
if mfe_base_url:
studio_home_url = f'{mfe_base_url}/home'
return studio_home_url
raise ImproperlyConfigured(
"The COURSE_AUTHORING_MICROFRONTEND_URL must be configured. "
"Please set it to the base url for your authoring MFE."
)
def get_schedule_details_url(course_locator) -> str:

View File

@@ -86,7 +86,6 @@ from ..tasks import rerun_course as rerun_course_task
from ..toggles import (
default_enable_flexible_peer_openassessments,
use_new_course_outline_page,
use_new_home_page,
use_new_updates_page,
use_new_advanced_settings_page,
use_new_grading_page,
@@ -105,7 +104,6 @@ from ..utils import (
get_grading_url,
get_group_configurations_context,
get_group_configurations_url,
get_home_context,
get_library_context,
get_lms_link_for_item,
get_proctored_exam_settings_url,
@@ -652,11 +650,7 @@ def course_listing(request):
"""
List all courses and libraries available to the logged in user
"""
if use_new_home_page():
return redirect(get_studio_home_url())
home_context = get_home_context(request)
return render_to_response('index.html', home_context)
return redirect(get_studio_home_url())
@login_required

View File

@@ -16,22 +16,12 @@
<header class="primary" role="banner">
<div class="wrapper wrapper-l">
<h1 class="branding">
% if not toggles.use_new_home_page():
<a class="brand-link" href="/">
<img class="brand-image" src="${static.url('images/studio-logo.png')}" alt="${settings.STUDIO_NAME}" />
% if settings.LOGO_IMAGE_EXTRA_TEXT == 'edge':
<span class="font-italic"> <span class="tilted">|</span> EDGE</span>
% endif
</a>
% endif
% if toggles.use_new_home_page():
<a class="brand-link" href="${get_studio_home_url()}">
<img class="brand-image" src="${static.url('images/studio-logo.png')}" alt="${settings.STUDIO_NAME}" />
% if settings.LOGO_IMAGE_EXTRA_TEXT == 'edge':
<span class="font-italic"> <span class="tilted">|</span> EDGE</span>
% endif
</a>
% endif
</h1>