Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable video status translation for JSON endpoint #33939

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions cms/djangoapps/contentstore/video_storage_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@ class StatusDisplayStrings:

@staticmethod
def get(val_status):
"""Map a VAL status string to a localized display string"""
# pylint: disable=translation-of-non-string
return _(StatusDisplayStrings._STATUS_MAP.get(val_status, StatusDisplayStrings._UNKNOWN))
"""Map a VAL status string to a display string"""
return StatusDisplayStrings._STATUS_MAP.get(val_status, StatusDisplayStrings._UNKNOWN)


def handle_videos(request, course_key_string, edx_video_id=None):
Expand Down Expand Up @@ -657,7 +656,10 @@ def _get_videos(course, pagination_conf=None):
language_code=language_code,
)
# Convert the video status.
video['status'] = convert_video_status(video, is_video_encodes_ready)
# Legacy frontend expects the status to be translated unlike MFEs which handle translation themselves.
video['status_nontranslated'] = convert_video_status(video, is_video_encodes_ready)
# pylint: disable=translation-of-non-string
video['status'] = _(video['status_nontranslated'])

return videos, pagination_context

Expand All @@ -675,7 +677,7 @@ def _get_index_videos(course, pagination_conf=None):
"""
course_id = str(course.id)
attrs = [
'edx_video_id', 'client_video_id', 'created', 'duration',
'edx_video_id', 'client_video_id', 'created', 'duration', 'status_nontranslated',
'status', 'courses', 'encoded_videos', 'transcripts', 'transcription_status',
'transcript_urls', 'error_description'
]
Expand Down
9 changes: 5 additions & 4 deletions cms/djangoapps/contentstore/views/tests/test_videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ def test_get_json(self):
'created',
'duration',
'status',
'status_nontranslated',
'course_video_image_url',
'file_size',
'download_link',
Expand All @@ -388,8 +389,8 @@ def test_get_json(self):
(
[
'edx_video_id', 'client_video_id', 'created', 'duration',
'status', 'course_video_image_url', 'file_size', 'download_link',
'transcripts', 'transcription_status', 'transcript_urls',
'status', 'status_nontranslated', 'course_video_image_url', 'file_size',
'download_link', 'transcripts', 'transcription_status', 'transcript_urls',
'error_description'
],
[
Expand All @@ -406,8 +407,8 @@ def test_get_json(self):
(
[
'edx_video_id', 'client_video_id', 'created', 'duration',
'status', 'course_video_image_url', 'file_size', 'download_link',
'transcripts', 'transcription_status', 'transcript_urls',
'status', 'status_nontranslated', 'course_video_image_url', 'file_size',
'download_link', 'transcripts', 'transcription_status', 'transcript_urls',
'error_description'
],
[
Expand Down
Loading