From 482b63baaf625d0fab9b8862a70fe23b9312d4bf Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Wed, 26 Jul 2017 14:19:19 -0400 Subject: [PATCH] Handle tab hiding at a different level. --- lms/djangoapps/courseware/tabs.py | 8 ++++---- lms/djangoapps/courseware/tests/test_tabs.py | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index 3ea1dd36ae..bcfd6ca6eb 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -70,10 +70,7 @@ class CourseInfoTab(CourseTab): @classmethod def is_enabled(cls, course, user=None): - """ - The "Home" tab is not shown for the new unified course experience. - """ - return not UNIFIED_COURSE_TAB_FLAG.is_enabled(course.id) + return True class SyllabusTab(EnrolledTab): @@ -326,6 +323,9 @@ def get_course_tab_list(request, course): if tab.type != 'courseware': continue tab.name = _("Entrance Exam") + # TODO: LEARNER-611 - once the course_info tab is removed, remove this code + if UNIFIED_COURSE_TAB_FLAG.is_enabled(course.id) and tab.type == 'course_info': + continue if tab.type == 'static_tab' and tab.course_staff_only and \ not bool(user and has_access(user, 'staff', course, course.id)): continue diff --git a/lms/djangoapps/courseware/tests/test_tabs.py b/lms/djangoapps/courseware/tests/test_tabs.py index fced69faa4..577383e40e 100644 --- a/lms/djangoapps/courseware/tests/test_tabs.py +++ b/lms/djangoapps/courseware/tests/test_tabs.py @@ -792,6 +792,14 @@ class CourseInfoTabTestCase(TabTestCase): tabs = get_course_tab_list(self.request, self.course) self.assertEqual(tabs[0].type, 'courseware') + # TODO: LEARNER-611 - remove once course_info is removed. + @override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=True) + def test_default_tab_for_displayable(self): + tabs = xmodule_tabs.CourseTabList.iterate_displayable(self.course, self.user) + for i, tab in enumerate(tabs): + if i == 0: + self.assertEqual(tab.type, 'course_info') + @attr(shard=1) class DiscussionLinkTestCase(TabTestCase):