From 0d0f9e7b3c6df25141879f608ddbc5be9e225435 Mon Sep 17 00:00:00 2001 From: Kristin Aoki <42981026+KristinAoki@users.noreply.github.com> Date: Wed, 5 Oct 2022 11:09:24 -0400 Subject: [PATCH] feat: add video_images_upload_enabled api so new video editor knows val --- cms/djangoapps/contentstore/views/videos.py | 12 ++++++++++++ cms/urls.py | 2 ++ 2 files changed, 14 insertions(+) diff --git a/cms/djangoapps/contentstore/views/videos.py b/cms/djangoapps/contentstore/views/videos.py index bc0cfdf30479..d9de03a854a2 100644 --- a/cms/djangoapps/contentstore/views/videos.py +++ b/cms/djangoapps/contentstore/views/videos.py @@ -63,6 +63,7 @@ 'videos_handler', 'video_encodings_download', 'video_images_handler', + 'video_images_upload_enabled', 'transcript_preferences_handler', 'generate_video_upload_link_handler', ] @@ -263,6 +264,17 @@ def video_images_handler(request, course_key_string, edx_video_id=None): return JsonResponse({'image_url': image_url}) +@login_required +@require_GET +def video_images_upload_enabled(request): + """Function to check if images can be uploaded""" + # respond with a false if image upload is not enabled. + if not VIDEO_IMAGE_UPLOAD_ENABLED.is_enabled(): + return JsonResponse({'allowThumbnailUpload': False}) + + return JsonResponse({'allowThumbnailUpload': True}) + + def validate_transcript_preferences(provider, cielo24_fidelity, cielo24_turnaround, three_play_turnaround, video_source_language, preferred_languages): """ diff --git a/cms/urls.py b/cms/urls.py index 8a881339e220..af851e21d4fe 100644 --- a/cms/urls.py +++ b/cms/urls.py @@ -162,6 +162,8 @@ contentstore_views.generate_video_upload_link_handler, name='generate_video_upload_link'), re_path(fr'^video_images/{settings.COURSE_KEY_PATTERN}(?:/(?P[-\w]+))?$', contentstore_views.video_images_handler, name='video_images_handler'), + path('video_images_upload_enabled', contentstore_views.video_images_upload_enabled, + name='video_images_upload_enabled'), re_path(fr'^transcript_preferences/{settings.COURSE_KEY_PATTERN}$', contentstore_views.transcript_preferences_handler, name='transcript_preferences_handler'), re_path(fr'^transcript_credentials/{settings.COURSE_KEY_PATTERN}$',