From aaaafee2b21f1e7bd379846dcedbe9bb1dafbdae Mon Sep 17 00:00:00 2001 From: muhammad-ammar Date: Wed, 11 Apr 2018 18:59:00 +0500 Subject: [PATCH] remove video transcript enabled flag --- .../views/tests/test_transcript_settings.py | 97 +++++-------------- .../contentstore/views/tests/test_videos.py | 24 ++--- .../contentstore/views/transcript_settings.py | 23 +---- .../contentstore/views/transcripts_ajax.py | 3 - cms/djangoapps/contentstore/views/videos.py | 38 +++----- cms/static/js/factories/videos_index.js | 6 +- .../views/previous_video_upload_list_spec.js | 6 +- .../spec/views/previous_video_upload_spec.js | 6 +- .../js/spec/views/video_thumbnail_spec.js | 8 +- .../js/spec/views/video_transcripts_spec.js | 18 +--- cms/static/js/views/previous_video_upload.js | 24 ++--- .../js/views/previous_video_upload_list.js | 7 +- .../js/previous-video-upload-list.underscore | 2 - .../js/previous-video-upload.underscore | 2 - cms/urls.py | 6 +- .../lib/xmodule/xmodule/tests/test_video.py | 5 +- .../video_module/transcripts_model_utils.py | 14 --- .../xmodule/video_module/video_module.py | 4 +- .../courseware/tests/test_video_handlers.py | 26 ----- .../mobile_api/video_outlines/serializers.py | 1 - .../mobile_api/video_outlines/tests.py | 22 ----- .../mobile_api/video_outlines/views.py | 3 - 22 files changed, 87 insertions(+), 258 deletions(-) delete mode 100644 common/lib/xmodule/xmodule/video_module/transcripts_model_utils.py diff --git a/cms/djangoapps/contentstore/views/tests/test_transcript_settings.py b/cms/djangoapps/contentstore/views/tests/test_transcript_settings.py index 443131af6b..da838b1806 100644 --- a/cms/djangoapps/contentstore/views/tests/test_transcript_settings.py +++ b/cms/djangoapps/contentstore/views/tests/test_transcript_settings.py @@ -5,6 +5,7 @@ from io import BytesIO from mock import Mock, patch, ANY from django.test.testcases import TestCase +from django.core.urlresolvers import reverse from edxval import api from contentstore.tests.utils import CourseTestCase @@ -177,26 +178,24 @@ class TranscriptCredentialsValidationTest(TestCase): @ddt.ddt -@patch( - 'openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled', - Mock(return_value=True) -) class TranscriptDownloadTest(CourseTestCase): """ Tests for transcript download handler. """ - VIEW_NAME = 'transcript_download_handler' - def get_url_for_course_key(self, course_id): - return reverse_course_url(self.VIEW_NAME, course_id) + @property + def view_url(self): + """ + Returns url for this view + """ + return reverse('transcript_download_handler') def test_302_with_anonymous_user(self): """ Verify that redirection happens in case of unauthorized request. """ self.client.logout() - transcript_download_url = self.get_url_for_course_key(self.course.id) - response = self.client.get(transcript_download_url, content_type='application/json') + response = self.client.get(self.view_url, content_type='application/json') self.assertEqual(response.status_code, 302) def test_405_with_not_allowed_request_method(self): @@ -204,26 +203,14 @@ class TranscriptDownloadTest(CourseTestCase): Verify that 405 is returned in case of not-allowed request methods. Allowed request methods include GET. """ - transcript_download_url = self.get_url_for_course_key(self.course.id) - response = self.client.post(transcript_download_url, content_type='application/json') + response = self.client.post(self.view_url, content_type='application/json') self.assertEqual(response.status_code, 405) - def test_404_with_feature_disabled(self): - """ - Verify that 404 is returned if the corresponding feature is disabled. - """ - transcript_download_url = self.get_url_for_course_key(self.course.id) - with patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled') as feature: - feature.return_value = False - response = self.client.get(transcript_download_url, content_type='application/json') - self.assertEqual(response.status_code, 404) - @patch('contentstore.views.transcript_settings.get_video_transcript_data') def test_transcript_download_handler(self, mock_get_video_transcript_data): """ Tests that transcript download handler works as expected. """ - transcript_download_url = self.get_url_for_course_key(self.course.id) mock_get_video_transcript_data.return_value = { 'content': json.dumps({ "start": [10], @@ -235,7 +222,7 @@ class TranscriptDownloadTest(CourseTestCase): # Make request to transcript download handler response = self.client.get( - transcript_download_url, + self.view_url, data={ 'edx_video_id': '123', 'language_code': 'en' @@ -277,34 +264,30 @@ class TranscriptDownloadTest(CourseTestCase): Tests that transcript download handler with missing attributes. """ # Make request to transcript download handler - transcript_download_url = self.get_url_for_course_key(self.course.id) - response = self.client.get(transcript_download_url, data=request_payload) + response = self.client.get(self.view_url, data=request_payload) # Assert the response self.assertEqual(response.status_code, 400) self.assertEqual(json.loads(response.content)['error'], expected_error_message) @ddt.ddt -@patch( - 'openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled', - Mock(return_value=True) -) class TranscriptUploadTest(CourseTestCase): """ Tests for transcript upload handler. """ - VIEW_NAME = 'transcript_upload_handler' - - def get_url_for_course_key(self, course_id): - return reverse_course_url(self.VIEW_NAME, course_id) + @property + def view_url(self): + """ + Returns url for this view + """ + return reverse('transcript_upload_handler') def test_302_with_anonymous_user(self): """ Verify that redirection happens in case of unauthorized request. """ self.client.logout() - transcript_upload_url = self.get_url_for_course_key(self.course.id) - response = self.client.post(transcript_upload_url, content_type='application/json') + response = self.client.post(self.view_url, content_type='application/json') self.assertEqual(response.status_code, 302) def test_405_with_not_allowed_request_method(self): @@ -312,31 +295,19 @@ class TranscriptUploadTest(CourseTestCase): Verify that 405 is returned in case of not-allowed request methods. Allowed request methods include POST. """ - transcript_upload_url = self.get_url_for_course_key(self.course.id) - response = self.client.get(transcript_upload_url, content_type='application/json') + response = self.client.get(self.view_url, content_type='application/json') self.assertEqual(response.status_code, 405) - def test_404_with_feature_disabled(self): - """ - Verify that 404 is returned if the corresponding feature is disabled. - """ - transcript_upload_url = self.get_url_for_course_key(self.course.id) - with patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled') as feature: - feature.return_value = False - response = self.client.post(transcript_upload_url, content_type='application/json') - self.assertEqual(response.status_code, 404) - @patch('contentstore.views.transcript_settings.create_or_update_video_transcript') @patch('contentstore.views.transcript_settings.get_available_transcript_languages', Mock(return_value=['en'])) def test_transcript_upload_handler(self, mock_create_or_update_video_transcript): """ Tests that transcript upload handler works as expected. """ - transcript_upload_url = self.get_url_for_course_key(self.course.id) transcript_file_stream = BytesIO('0\n00:00:00,010 --> 00:00:00,100\nПривіт, edX вітає вас.\n\n') # Make request to transcript upload handler response = self.client.post( - transcript_upload_url, + self.view_url, { 'edx_video_id': '123', 'language_code': 'en', @@ -395,9 +366,8 @@ class TranscriptUploadTest(CourseTestCase): """ Tests the transcript upload handler when the required attributes are missing. """ - transcript_upload_url = self.get_url_for_course_key(self.course.id) # Make request to transcript upload handler - response = self.client.post(transcript_upload_url, request_payload, format='multipart') + response = self.client.post(self.view_url, request_payload, format='multipart') self.assertEqual(response.status_code, 400) self.assertEqual(json.loads(response.content)['error'], expected_error_message) @@ -407,14 +377,13 @@ class TranscriptUploadTest(CourseTestCase): Tests that upload handler do not update transcript's language if a transcript with the same language already present for an edx_video_id. """ - transcript_upload_url = self.get_url_for_course_key(self.course.id) # Make request to transcript upload handler request_payload = { 'edx_video_id': '1234', 'language_code': 'en', 'new_language_code': 'es' } - response = self.client.post(transcript_upload_url, request_payload, format='multipart') + response = self.client.post(self.view_url, request_payload, format='multipart') self.assertEqual(response.status_code, 400) self.assertEqual( json.loads(response.content)['error'], @@ -427,10 +396,9 @@ class TranscriptUploadTest(CourseTestCase): Tests the transcript upload handler with an image file. """ with make_image_file() as image_file: - transcript_upload_url = self.get_url_for_course_key(self.course.id) # Make request to transcript upload handler response = self.client.post( - transcript_upload_url, + self.view_url, { 'edx_video_id': '123', 'language_code': 'en', @@ -451,11 +419,10 @@ class TranscriptUploadTest(CourseTestCase): """ Tests the transcript upload handler with an invalid transcript file. """ - transcript_upload_url = self.get_url_for_course_key(self.course.id) transcript_file_stream = BytesIO('An invalid transcript SubRip file content') # Make request to transcript upload handler response = self.client.post( - transcript_upload_url, + self.view_url, { 'edx_video_id': '123', 'language_code': 'en', @@ -473,11 +440,7 @@ class TranscriptUploadTest(CourseTestCase): @ddt.ddt -@patch( - 'openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled', - Mock(return_value=True) -) -class TranscriptUploadTest(CourseTestCase): +class TranscriptDeleteTest(CourseTestCase): """ Tests for transcript deletion handler. """ @@ -504,16 +467,6 @@ class TranscriptUploadTest(CourseTestCase): response = self.client.post(transcript_delete_url) self.assertEqual(response.status_code, 405) - def test_404_with_feature_disabled(self): - """ - Verify that 404 is returned if the corresponding feature is disabled. - """ - transcript_delete_url = self.get_url_for_course_key(self.course.id, edx_video_id='test_id', language_code='en') - with patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled') as feature: - feature.return_value = False - response = self.client.delete(transcript_delete_url) - self.assertEqual(response.status_code, 404) - def test_404_with_non_staff_user(self): """ Verify that 404 is returned if the user doesn't have studio write access. diff --git a/cms/djangoapps/contentstore/views/tests/test_videos.py b/cms/djangoapps/contentstore/views/tests/test_videos.py index b9c0abbfc9..c2e63cb8dd 100644 --- a/cms/djangoapps/contentstore/views/tests/test_videos.py +++ b/cms/djangoapps/contentstore/views/tests/test_videos.py @@ -224,7 +224,15 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase): original_video = self.previous_uploads[-(i + 1)] self.assertEqual( set(response_video.keys()), - set(['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'course_video_image_url']) + set([ + 'edx_video_id', + 'client_video_id', + 'created', + 'duration', + 'status', + 'course_video_image_url', + 'transcripts' + ]) ) dateutil.parser.parse(response_video['created']) for field in ['edx_video_id', 'client_video_id', 'duration']: @@ -236,13 +244,6 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase): @ddt.data( ( - False, - ['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'course_video_image_url'], - [], - [] - ), - ( - True, ['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'course_video_image_url', 'transcripts'], [ @@ -257,7 +258,6 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase): ['en'] ), ( - True, ['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'course_video_image_url', 'transcripts'], [ @@ -280,14 +280,10 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase): ) ) @ddt.unpack - @patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled') - def test_get_json_transcripts(self, is_video_transcript_enabled, expected_video_keys, uploaded_transcripts, - expected_transcripts, video_transcript_feature): + def test_get_json_transcripts(self, expected_video_keys, uploaded_transcripts, expected_transcripts): """ Test that transcripts are attached based on whether the video transcript feature is enabled. """ - video_transcript_feature.return_value = is_video_transcript_enabled - for transcript in uploaded_transcripts: create_or_update_video_transcript( transcript['video_id'], diff --git a/cms/djangoapps/contentstore/views/transcript_settings.py b/cms/djangoapps/contentstore/views/transcript_settings.py index cb891107fb..e53c81eac1 100644 --- a/cms/djangoapps/contentstore/views/transcript_settings.py +++ b/cms/djangoapps/contentstore/views/transcript_settings.py @@ -130,23 +130,18 @@ def transcript_credentials_handler(request, course_key_string): @login_required @require_GET -def transcript_download_handler(request, course_key_string): +def transcript_download_handler(request): """ JSON view handler to download a transcript. Arguments: request: WSGI request object - course_key_string: course key Returns: - A 200 response with SRT transcript file attached. - A 400 if there is a validation error. - - A 404 if there is no such transcript or feature flag is disabled. + - A 404 if there is no such transcript. """ - course_key = CourseKey.from_string(course_key_string) - if not VideoTranscriptEnabledFlag.feature_enabled(course_key): - return HttpResponseNotFound() - missing = [attr for attr in ['edx_video_id', 'language_code'] if attr not in request.GET] if missing: return JsonResponse( @@ -206,27 +201,20 @@ def validate_transcript_upload_data(data, files): @login_required @require_POST -def transcript_upload_handler(request, course_key_string): +def transcript_upload_handler(request): """ View to upload a transcript file. Arguments: request: A WSGI request object - course_key_string: Course key identifying a course Transcript file, edx video id and transcript language are required. Transcript file should be in SRT(SubRip) format. Returns - A 400 if any of the validation fails - - A 404 if the corresponding feature flag is disabled - A 200 if transcript has been uploaded successfully """ - # Check whether the feature is available for this course. - course_key = CourseKey.from_string(course_key_string) - if not VideoTranscriptEnabledFlag.feature_enabled(course_key): - return HttpResponseNotFound() - error = validate_transcript_upload_data(data=request.POST, files=request.FILES) if error: response = JsonResponse({'error': error}, status=400) @@ -276,14 +264,13 @@ def transcript_delete_handler(request, course_key_string, edx_video_id, language language_code: transcript's language code. Returns - - A 404 if the corresponding feature flag is disabled or user does not have required permisions + - A 404 if the user does not have required permisions - A 200 if transcript is deleted without any error(s) """ # Check whether the feature is available for this course. course_key = CourseKey.from_string(course_key_string) - video_transcripts_enabled = VideoTranscriptEnabledFlag.feature_enabled(course_key) # User needs to have studio write access for this course. - if not video_transcripts_enabled or not has_studio_write_access(request.user, course_key): + if not has_studio_write_access(request.user, course_key): return HttpResponseNotFound() delete_video_transcript(video_id=edx_video_id, language_code=language_code) diff --git a/cms/djangoapps/contentstore/views/transcripts_ajax.py b/cms/djangoapps/contentstore/views/transcripts_ajax.py index b659ff8c59..e5501d46e2 100644 --- a/cms/djangoapps/contentstore/views/transcripts_ajax.py +++ b/cms/djangoapps/contentstore/views/transcripts_ajax.py @@ -45,9 +45,6 @@ from xmodule.video_module.transcripts_utils import ( get_transcript, get_transcript_from_val, ) -from xmodule.video_module.transcripts_model_utils import ( - is_val_transcript_feature_enabled_for_course -) from cms.djangoapps.contentstore.views.videos import TranscriptProvider diff --git a/cms/djangoapps/contentstore/views/videos.py b/cms/djangoapps/contentstore/views/videos.py index 2844d9ddd0..8c8dce3f53 100644 --- a/cms/djangoapps/contentstore/views/videos.py +++ b/cms/djangoapps/contentstore/views/videos.py @@ -15,6 +15,7 @@ from django.conf import settings from django.contrib.auth.decorators import login_required from django.contrib.staticfiles.storage import staticfiles_storage from django.core.files.images import get_image_dimensions +from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseNotFound from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_noop @@ -533,15 +534,12 @@ def _get_videos(course): """ Retrieves the list of videos from VAL corresponding to this course. """ - is_video_transcript_enabled = VideoTranscriptEnabledFlag.feature_enabled(course.id) videos = list(get_videos_for_course(unicode(course.id), VideoSortField.created, SortDirection.desc)) # convert VAL's status to studio's Video Upload feature status. for video in videos: video["status"] = convert_video_status(video) - - if is_video_transcript_enabled: - video['transcripts'] = get_available_transcript_languages(video_id=video['edx_video_id']) + video['transcripts'] = get_available_transcript_languages(video_id=video['edx_video_id']) return videos @@ -558,10 +556,7 @@ def _get_index_videos(course): Returns the information about each video upload required for the video list """ course_id = unicode(course.id) - attrs = ['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'courses'] - - if VideoTranscriptEnabledFlag.feature_enabled(course.id): - attrs += ['transcripts'] + attrs = ['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'courses', 'transcripts'] def _get_values(video): """ @@ -631,14 +626,19 @@ def videos_index_html(course): 'supported_file_formats': settings.VIDEO_IMAGE_SUPPORTED_FILE_FORMATS }, 'is_video_transcript_enabled': is_video_transcript_enabled, - 'video_transcript_settings': None, 'active_transcript_preferences': None, 'transcript_credentials': None, - 'transcript_available_languages': None + 'transcript_available_languages': get_all_transcript_languages(), + 'video_transcript_settings': { + 'transcript_download_handler_url': reverse('transcript_download_handler'), + 'transcript_upload_handler_url': reverse('transcript_upload_handler'), + 'transcript_delete_handler_url': reverse_course_url('transcript_delete_handler', unicode(course.id)), + 'trancript_download_file_format': Transcript.SRT + } } if is_video_transcript_enabled: - context['video_transcript_settings'] = { + context['video_transcript_settings'].update({ 'transcript_preferences_handler_url': reverse_course_url( 'transcript_preferences_handler', unicode(course.id) @@ -647,25 +647,11 @@ def videos_index_html(course): 'transcript_credentials_handler', unicode(course.id) ), - 'transcript_download_handler_url': reverse_course_url( - 'transcript_download_handler', - unicode(course.id) - ), - 'transcript_upload_handler_url': reverse_course_url( - 'transcript_upload_handler', - unicode(course.id) - ), - 'transcript_delete_handler_url': reverse_course_url( - 'transcript_delete_handler', - unicode(course.id) - ), 'transcription_plans': get_3rd_party_transcription_plans(), - 'trancript_download_file_format': Transcript.SRT - } + }) context['active_transcript_preferences'] = get_transcript_preferences(unicode(course.id)) # Cached state for transcript providers' credentials (org-specific) context['transcript_credentials'] = get_transcript_credentials_state_for_org(course.id.org) - context['transcript_available_languages'] = get_all_transcript_languages() return render_to_response('videos_index.html', context) diff --git a/cms/static/js/factories/videos_index.js b/cms/static/js/factories/videos_index.js index 2852b74e89..3d1c871ea0 100644 --- a/cms/static/js/factories/videos_index.js +++ b/cms/static/js/factories/videos_index.js @@ -55,8 +55,7 @@ define([ videoImageSettings: videoImageSettings, videoTranscriptSettings: videoTranscriptSettings, transcriptAvailableLanguages: transcriptAvailableLanguages, - videoSupportedFileFormats: videoSupportedFileFormats, - isVideoTranscriptEnabled: isVideoTranscriptEnabled + videoSupportedFileFormats: videoSupportedFileFormats }); $contentWrapper.find('.wrapper-assets').replaceWith(updatedView.render().$el); }); @@ -71,8 +70,7 @@ define([ videoImageSettings: videoImageSettings, videoTranscriptSettings: videoTranscriptSettings, transcriptAvailableLanguages: transcriptAvailableLanguages, - videoSupportedFileFormats: videoSupportedFileFormats, - isVideoTranscriptEnabled: isVideoTranscriptEnabled + videoSupportedFileFormats: videoSupportedFileFormats }); $contentWrapper.append(activeView.render().$el); $contentWrapper.append(previousView.render().$el); diff --git a/cms/static/js/spec/views/previous_video_upload_list_spec.js b/cms/static/js/spec/views/previous_video_upload_list_spec.js index 7202384489..d5653cb537 100644 --- a/cms/static/js/spec/views/previous_video_upload_list_spec.js +++ b/cms/static/js/spec/views/previous_video_upload_list_spec.js @@ -11,7 +11,8 @@ define( duration: 42, created: '2014-11-25T23:13:05', edx_video_id: 'dummy_id', - status: 'uploading' + status: 'uploading', + transcripts: [] }; var collection = new Backbone.Collection( _.map( @@ -26,6 +27,9 @@ define( var view = new PreviousVideoUploadListView({ collection: collection, videoHandlerUrl: videoHandlerUrl, + transcriptAvailableLanguages: [], + videoSupportedFileFormats: [], + videoTranscriptSettings: {}, videoImageSettings: {} }); return view.render().$el; diff --git a/cms/static/js/spec/views/previous_video_upload_spec.js b/cms/static/js/spec/views/previous_video_upload_spec.js index 9a9c0041d1..f565b52372 100644 --- a/cms/static/js/spec/views/previous_video_upload_spec.js +++ b/cms/static/js/spec/views/previous_video_upload_spec.js @@ -10,11 +10,15 @@ define( duration: 42, created: '2014-11-25T23:13:05', edx_video_id: 'dummy_id', - status: 'uploading' + status: 'uploading', + transcripts: [] }, view = new PreviousVideoUploadView({ model: new Backbone.Model($.extend({}, defaultData, modelData)), videoHandlerUrl: '/videos/course-v1:org.0+course_0+Run_0', + transcriptAvailableLanguages: [], + videoSupportedFileFormats: [], + videoTranscriptSettings: {}, videoImageSettings: {} }); return view.render().$el; diff --git a/cms/static/js/spec/views/video_thumbnail_spec.js b/cms/static/js/spec/views/video_thumbnail_spec.js index 237f20c7ee..df4c55d2a5 100644 --- a/cms/static/js/spec/views/video_thumbnail_spec.js +++ b/cms/static/js/spec/views/video_thumbnail_spec.js @@ -43,7 +43,8 @@ define( duration: 42, created: '2014-11-25T23:13:05', edx_video_id: 'dummy_id', - status: 'uploading' + status: 'uploading', + transcripts: [] }, collection = new Backbone.Collection(_.map(_.range(numVideos), function(num, index) { return new Backbone.Model( @@ -61,7 +62,10 @@ define( max_height: VIDEO_IMAGE_MAX_HEIGHT, supported_file_formats: VIDEO_IMAGE_SUPPORTED_FILE_FORMATS, video_image_upload_enabled: videoImageUploadEnabled - } + }, + transcriptAvailableLanguages: [], + videoSupportedFileFormats: [], + videoTranscriptSettings: {} }); $videoListEl = videoListView.render().$el; diff --git a/cms/static/js/spec/views/video_transcripts_spec.js b/cms/static/js/spec/views/video_transcripts_spec.js index 4f76d91f37..47e230b125 100644 --- a/cms/static/js/spec/views/video_transcripts_spec.js +++ b/cms/static/js/spec/views/video_transcripts_spec.js @@ -93,9 +93,8 @@ define( return new File([new Blob([Array(size).join('i')], {type: type})], transcriptFileName); }; - renderView = function(availableTranscripts, isVideoTranscriptEnabled) { + renderView = function(availableTranscripts) { var videoViewIndex = 0, - isVideoTranscriptEnabled = isVideoTranscriptEnabled || _.isUndefined(isVideoTranscriptEnabled), // eslint-disable-line max-len, no-redeclare videoData = { client_video_id: clientVideoID, edx_video_id: edxVideoID, @@ -109,8 +108,7 @@ define( videoImageSettings: {}, videoTranscriptSettings: videoTranscriptSettings, transcriptAvailableLanguages: transcriptAvailableLanguages, - videoSupportedFileFormats: videoSupportedFileFormats, - isVideoTranscriptEnabled: isVideoTranscriptEnabled + videoSupportedFileFormats: videoSupportedFileFormats }); videoListView.setElement($('.wrapper-assets')); videoListView.render(); @@ -139,18 +137,6 @@ define( expect(_.isUndefined(videoTranscriptsView)).toEqual(false); }); - it('does not render transcripts view if feature is disabled', function() { - renderView(transcripts, false); - // Verify transcript container is not present. - expect(videoListView.$el.find('.video-transcripts-header')).not.toExist(); - // Veirfy transcript column header is not present. - expect(videoListView.$el.find('.js-table-head .video-head-col.transcripts-col')).not.toExist(); - // Verify transcript data column is not present. - expect(videoListView.$el.find('.js-table-body .transcripts-col')).not.toExist(); - // Verify view has not initiallized. - expect(_.isUndefined(videoTranscriptsView)).toEqual(true); - }); - it('does not show list of transcripts initially', function() { expect( videoTranscriptsView.$el.find('.video-transcripts-wrapper').hasClass('hidden') diff --git a/cms/static/js/views/previous_video_upload.js b/cms/static/js/views/previous_video_upload.js index 714e4e54ac..755657f16c 100644 --- a/cms/static/js/views/previous_video_upload.js +++ b/cms/static/js/views/previous_video_upload.js @@ -20,7 +20,6 @@ define( this.template = HtmlUtils.template(previousVideoUploadTemplate); this.videoHandlerUrl = options.videoHandlerUrl; this.videoImageUploadEnabled = options.videoImageSettings.video_image_upload_enabled; - this.isVideoTranscriptEnabled = options.isVideoTranscriptEnabled; if (this.videoImageUploadEnabled) { this.videoThumbnailView = new VideoThumbnailView({ @@ -30,22 +29,19 @@ define( videoImageSettings: options.videoImageSettings }); } - if (this.isVideoTranscriptEnabled) { - this.videoTranscriptsView = new VideoTranscriptsView({ - transcripts: this.model.get('transcripts'), - edxVideoID: this.model.get('edx_video_id'), - clientVideoID: this.model.get('client_video_id'), - transcriptAvailableLanguages: options.transcriptAvailableLanguages, - videoSupportedFileFormats: options.videoSupportedFileFormats, - videoTranscriptSettings: options.videoTranscriptSettings - }); - } + this.videoTranscriptsView = new VideoTranscriptsView({ + transcripts: this.model.get('transcripts'), + edxVideoID: this.model.get('edx_video_id'), + clientVideoID: this.model.get('client_video_id'), + transcriptAvailableLanguages: options.transcriptAvailableLanguages, + videoSupportedFileFormats: options.videoSupportedFileFormats, + videoTranscriptSettings: options.videoTranscriptSettings + }); }, render: function() { var renderedAttributes = { videoImageUploadEnabled: this.videoImageUploadEnabled, - isVideoTranscriptEnabled: this.isVideoTranscriptEnabled, created: DateUtils.renderDate(this.model.get('created')), status: this.model.get('status') }; @@ -59,9 +55,7 @@ define( if (this.videoImageUploadEnabled) { this.videoThumbnailView.setElement(this.$('.thumbnail-col')).render(); } - if (this.isVideoTranscriptEnabled) { - this.videoTranscriptsView.setElement(this.$('.transcripts-col')).render(); - } + this.videoTranscriptsView.setElement(this.$('.transcripts-col')).render(); return this; }, diff --git a/cms/static/js/views/previous_video_upload_list.js b/cms/static/js/views/previous_video_upload_list.js index c845a6e99b..48b4e30311 100644 --- a/cms/static/js/views/previous_video_upload_list.js +++ b/cms/static/js/views/previous_video_upload_list.js @@ -11,7 +11,6 @@ define( this.template = HtmlUtils.template(previousVideoUploadListTemplate); this.encodingsDownloadUrl = options.encodingsDownloadUrl; this.videoImageUploadEnabled = options.videoImageSettings.video_image_upload_enabled; - this.isVideoTranscriptEnabled = options.isVideoTranscriptEnabled; this.itemViews = this.collection.map(function(model) { return new PreviousVideoUploadView({ videoImageUploadURL: options.videoImageUploadURL, @@ -21,8 +20,7 @@ define( videoTranscriptSettings: options.videoTranscriptSettings, model: model, transcriptAvailableLanguages: options.transcriptAvailableLanguages, - videoSupportedFileFormats: options.videoSupportedFileFormats, - isVideoTranscriptEnabled: options.isVideoTranscriptEnabled + videoSupportedFileFormats: options.videoSupportedFileFormats }); }); }, @@ -35,8 +33,7 @@ define( this.$el, this.template({ encodingsDownloadUrl: this.encodingsDownloadUrl, - videoImageUploadEnabled: this.videoImageUploadEnabled, - isVideoTranscriptEnabled: this.isVideoTranscriptEnabled + videoImageUploadEnabled: this.videoImageUploadEnabled }) ); diff --git a/cms/templates/js/previous-video-upload-list.underscore b/cms/templates/js/previous-video-upload-list.underscore index 3248aa78f8..e3569d0403 100644 --- a/cms/templates/js/previous-video-upload-list.underscore +++ b/cms/templates/js/previous-video-upload-list.underscore @@ -14,9 +14,7 @@
<%- gettext("Name") %>
<%- gettext("Date Added") %>
<%- gettext("Video ID") %>
- <% if (isVideoTranscriptEnabled) { %>
<%- gettext("Transcripts") %>
- <% } %>
<%- gettext("Status") %>
<%- gettext("Action") %>
diff --git a/cms/templates/js/previous-video-upload.underscore b/cms/templates/js/previous-video-upload.underscore index 716198f921..4ab630d5fd 100644 --- a/cms/templates/js/previous-video-upload.underscore +++ b/cms/templates/js/previous-video-upload.underscore @@ -5,9 +5,7 @@
<%- client_video_id %>
<%- created %>
<%- edx_video_id %>
- <% if (isVideoTranscriptEnabled) { %>
- <% } %>
<%- status %>