feat: use function to access xpert translations ui waffle flag

This commit is contained in:
hajorg
2023-12-05 17:36:13 +01:00
parent 4bc2e74a40
commit 0190a0cc9e
2 changed files with 10 additions and 2 deletions

View File

@@ -77,6 +77,7 @@ from cms.djangoapps.contentstore.toggles import (
use_new_video_uploads_page,
use_new_custom_pages,
use_tagging_taxonomy_list_page,
# use_xpert_translations_component,
)
from cms.djangoapps.models.settings.course_grading import CourseGradingModel
from xmodule.library_tools import LibraryToolsService
@@ -1595,7 +1596,7 @@ def get_course_videos_context(course_block, pagination_conf, course_key=None):
get_transcript_preferences,
)
from openedx.core.djangoapps.video_config.models import VideoTranscriptEnabledFlag
from openedx.core.djangoapps.video_config.toggles import XPERT_TRANSLATIONS_UI
from openedx.core.djangoapps.video_config.toggles import use_xpert_translations_component
from xmodule.video_block.transcripts_utils import Transcript # lint-amnesty, pylint: disable=wrong-import-order
from .video_storage_handlers import (
@@ -1620,7 +1621,7 @@ def get_course_videos_context(course_block, pagination_conf, course_key=None):
course = modulestore().get_course(course_key)
is_video_transcript_enabled = VideoTranscriptEnabledFlag.feature_enabled(course.id)
is_ai_translations_enabled = XPERT_TRANSLATIONS_UI.is_enabled(course.id)
is_ai_translations_enabled = use_xpert_translations_component(course.id)
previous_uploads, pagination_context = _get_index_videos(course, pagination_conf)
course_video_context = {
'context_course': course,

View File

@@ -37,3 +37,10 @@ TRANSCRIPT_FEEDBACK = CourseWaffleFlag(
XPERT_TRANSLATIONS_UI = CourseWaffleFlag(
f'{WAFFLE_FLAG_NAMESPACE}.xpert_translations_ui', __name__
)
def use_xpert_translations_component(course_key):
"""
Returns a boolean if xpert translations ui component is enabled
"""
return XPERT_TRANSLATIONS_UI.is_enabled(course_key)