From f9fe00ff6c0dfc0af36a7116543dcdba09e130b1 Mon Sep 17 00:00:00 2001 From: Waheed Ahmed Date: Fri, 5 Jun 2015 21:41:42 +0500 Subject: [PATCH 1/8] Fixed youtube video was not loading even youtube is available. TNL-2361 --- common/lib/xmodule/xmodule/js/src/video/01_initialize.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js index 05654966f5..fc112b939b 100644 --- a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js +++ b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js @@ -532,12 +532,9 @@ function (VideoPlayer, VideoStorage, i18n) { this.youtubeXhr .always(function (json, status) { - var err = $.isPlainObject(json.error) || - ( - status !== 'success' && - status !== 'notmodified' - ); - if (err) { + // It will work for both if statusCode is 200 or 410. + var didSucceed = (json.error && json.error.code === 410) || status === 'success' || status === 'notmodified'; + if (!didSucceed) { console.log( '[Video info]: YouTube returned an error for ' + 'video with id "' + id + '".' From e47c97b465930f5e23ab2ec8540033df1fbfeccd Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sun, 7 Jun 2015 17:43:10 -0400 Subject: [PATCH 2/8] make courses.html also honor the ENABLE_COURSE_DISCOVERY feature flag --- lms/djangoapps/branding/tests/test_page.py | 46 +++++++++++++ lms/envs/bok_choy.env.json | 3 +- lms/envs/bok_choy.py | 3 + lms/static/sass/multicourse/_courses.scss | 78 ++++++++++++++++------ lms/templates/courseware/courses.html | 8 ++- 5 files changed, 116 insertions(+), 22 deletions(-) diff --git a/lms/djangoapps/branding/tests/test_page.py b/lms/djangoapps/branding/tests/test_page.py index 199784da06..ac4357e4f0 100644 --- a/lms/djangoapps/branding/tests/test_page.py +++ b/lms/djangoapps/branding/tests/test_page.py @@ -198,6 +198,52 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase): ) self.factory = RequestFactory() + @patch('student.views.render_to_response', RENDER_MOCK) + @patch('courseware.views.render_to_response', RENDER_MOCK) + @patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': False}) + def test_course_discovery_off(self): + """ + Asserts that the Course Discovery UI elements follow the + feature flag settings + """ + response = self.client.get('/') + self.assertEqual(response.status_code, 200) + # assert that the course discovery UI is not present + self.assertNotIn('Search for a course', response.content) + + # check the /courses view + response = self.client.get(reverse('branding.views.courses')) + self.assertEqual(response.status_code, 200) + + # assert that the course discovery UI is not present + self.assertNotIn('Search for a course', response.content) + self.assertNotIn('