diff --git a/lms/djangoapps/courseware/toggles.py b/lms/djangoapps/courseware/toggles.py index 9007b49f85..e1c6109654 100644 --- a/lms/djangoapps/courseware/toggles.py +++ b/lms/djangoapps/courseware/toggles.py @@ -125,6 +125,18 @@ COURSEWARE_MICROFRONTEND_PROCTORED_EXAMS = CourseWaffleFlag( WAFFLE_FLAG_NAMESPACE, 'mfe_proctored_exams', __name__ ) +# .. toggle_name: courseware.verified_name +# .. toggle_implementation: CourseWaffleFlag +# .. toggle_default: False +# .. toggle_description: Course waffle flag for verified name functionality (see https://github.com/edx/edx-name-affirmation) +# .. toggle_use_cases: temporary +# .. toggle_creation_date: 2021-7-14 +# .. toggle_target_removal_date: None +# .. toggle_warnings: None +COURSEWARE_VERIFIED_NAME_FLAG = CourseWaffleFlag( + WAFFLE_FLAG_NAMESPACE, 'verified_name', __name__ +) + def mfe_special_exams_is_active(course_key: CourseKey) -> bool: """ @@ -281,6 +293,10 @@ def streak_celebration_is_active(course_key): ) +def is_verified_name_enabled_for_course(course_key): + return COURSEWARE_VERIFIED_NAME_FLAG.is_enabled(course_key) + + # .. toggle_name: COURSES_INVITE_ONLY # .. toggle_implementation: SettingToggle # .. toggle_type: feature_flag diff --git a/lms/djangoapps/courseware/views/index.py b/lms/djangoapps/courseware/views/index.py index 8dd97c22a3..bdd14da23d 100644 --- a/lms/djangoapps/courseware/views/index.py +++ b/lms/djangoapps/courseware/views/index.py @@ -64,7 +64,11 @@ from ..masquerade import check_content_start_date_for_masquerade_user, setup_mas from ..model_data import FieldDataCache from ..module_render import get_module_for_descriptor, toc_for_course from ..permissions import MASQUERADE_AS_STUDENT -from ..toggles import courseware_legacy_is_visible, courseware_mfe_is_advertised +from ..toggles import ( + courseware_legacy_is_visible, + courseware_mfe_is_advertised, + is_verified_name_enabled_for_course +) from .views import CourseTabView log = logging.getLogger("edx.courseware.views.index") @@ -442,6 +446,7 @@ class CoursewareIndex(View): 'sequence_title': None, 'disable_accordion': not DISABLE_COURSE_OUTLINE_PAGE_FLAG.is_enabled(self.course.id), 'show_search': show_search, + 'is_verified_name_enabled': is_verified_name_enabled_for_course(self.course.id), } courseware_context.update( get_experiment_user_metadata_context( diff --git a/lms/templates/courseware/courseware.html b/lms/templates/courseware/courseware.html index 9391881336..5cba0fcd49 100644 --- a/lms/templates/courseware/courseware.html +++ b/lms/templates/courseware/courseware.html @@ -244,7 +244,8 @@ ${HTML(fragment.foot_html())} -
+
% if getattr(course, 'entrance_exam_enabled') and \ getattr(course, 'entrance_exam_minimum_score_pct') and \ entrance_exam_current_score is not UNDEFINED: