diff --git a/cms/djangoapps/contentstore/tasks.py b/cms/djangoapps/contentstore/tasks.py index 863863238036..3c5f60ca7c82 100644 --- a/cms/djangoapps/contentstore/tasks.py +++ b/cms/djangoapps/contentstore/tasks.py @@ -455,8 +455,8 @@ def sync_discussion_settings(course_key, user): if ( ENABLE_NEW_STRUCTURE_DISCUSSIONS.is_enabled() - and not course.discussions_settings['provider_type'] == Provider.OPEN_EDX - and not course.discussions_settings['provider'] == Provider.OPEN_EDX + and not course.discussions_settings.get('provider_type', None) == Provider.OPEN_EDX + and not course.discussions_settings.get('provider', None) == Provider.OPEN_EDX ): LOGGER.info(f"New structure is enabled, also updating {course_key} to use new provider") course.discussions_settings['enable_graded_units'] = False diff --git a/openedx/core/djangoapps/discussions/tasks.py b/openedx/core/djangoapps/discussions/tasks.py index 27682246a017..4b08112f8266 100644 --- a/openedx/core/djangoapps/discussions/tasks.py +++ b/openedx/core/djangoapps/discussions/tasks.py @@ -196,6 +196,10 @@ def update_unit_discussion_state_from_discussion_blocks(course_key: CourseKey, u """ store = modulestore() course = store.get_course(course_key) + # The provider information has been written to both `provider_type` and `provider`. + # Both of these serve the same purpose and this is an accident of early development. + # The `provider_type` key is now treated as read-only to allow existing values + # to be respected while moving to the `provider` key in the future. provider = course.discussions_settings.get( 'provider_type', course.discussions_settings.get('provider', None),