From 14f1fdf3c92f727528935e5c7b8aefeaaadd69eb Mon Sep 17 00:00:00 2001 From: Felipe Volpone Date: Thu, 22 Sep 2016 00:45:18 -0300 Subject: [PATCH] Disabling the "View Unit in Studio" button to CCX courses --- common/test/acceptance/pages/lms/ccx_dashboard_page.py | 6 ++++++ common/test/acceptance/tests/lms/test_ccx.py | 4 ++++ lms/djangoapps/ccx/overrides.py | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/common/test/acceptance/pages/lms/ccx_dashboard_page.py b/common/test/acceptance/pages/lms/ccx_dashboard_page.py index 6a5a0f27a7..0f2be9bce0 100644 --- a/common/test/acceptance/pages/lms/ccx_dashboard_page.py +++ b/common/test/acceptance/pages/lms/ccx_dashboard_page.py @@ -40,3 +40,9 @@ class CoachDashboardPage(CoursePage): lambda: self.q(css=create_ccx_button).present, "Create a new Custom Course for edX" ).fulfill() self.q(css=create_ccx_button).click() + + def is_button_view_unit_in_studio_visible(self): + """ + check if the View Unit in Studio button is on the page + """ + return self.q(css='instructor-info-action').present diff --git a/common/test/acceptance/tests/lms/test_ccx.py b/common/test/acceptance/tests/lms/test_ccx.py index 1a284f36cf..2a1105aa0e 100644 --- a/common/test/acceptance/tests/lms/test_ccx.py +++ b/common/test/acceptance/tests/lms/test_ccx.py @@ -56,3 +56,7 @@ class CreateCCXCoachTest(EventsTestMixin, UniqueCourseTest): # Assert that new ccx is created and we are on ccx dashboard/enrollment tab. self.assertTrue(self.coach_dashboard_page.is_browser_on_enrollment_page()) + + # Assert that the user cannot click in the "View Unit in Studio" button, + # which means the user cannot edit the ccx course in studio + self.assertFalse(self.coach_dashboard_page.is_button_view_unit_in_studio_visible()) diff --git a/lms/djangoapps/ccx/overrides.py b/lms/djangoapps/ccx/overrides.py index e3529d9af3..344135c9d8 100644 --- a/lms/djangoapps/ccx/overrides.py +++ b/lms/djangoapps/ccx/overrides.py @@ -88,6 +88,12 @@ def get_override_for_ccx(ccx, block, name, default=None): clean_ccx_key = _clean_ccx_key(block.location) block_overrides = overrides.get(clean_ccx_key, {}) + + # Hardcode the course_edit_method to be None instead of 'Studio', so, + # the LMS never tries to link back to Studio. CCX courses + # can't be edited in Studio. + block_overrides['course_edit_method'] = None + if name in block_overrides: try: return block.fields[name].from_json(block_overrides[name])