Skip to content

Commit

Permalink
feat: add video_images_upload_enabled api so new video editor knows val
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinAoki authored Oct 5, 2022
1 parent 78999c8 commit 0d0f9e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cms/djangoapps/contentstore/views/videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
'videos_handler',
'video_encodings_download',
'video_images_handler',
'video_images_upload_enabled',
'transcript_preferences_handler',
'generate_video_upload_link_handler',
]
Expand Down Expand Up @@ -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):
"""
Expand Down
2 changes: 2 additions & 0 deletions cms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<edx_video_id>[-\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}$',
Expand Down

0 comments on commit 0d0f9e7

Please sign in to comment.