Skip to content

Commit

Permalink
fix: info banner not visible when course is created (openedx#32133)
Browse files Browse the repository at this point in the history
Co-authored-by: adeel.tajamul <[email protected]>
  • Loading branch information
muhammadadeeltajamul and adeel.tajamul authored Apr 26, 2023
1 parent 18fab26 commit f08b4d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions cms/djangoapps/contentstore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from common.djangoapps.student.roles import CourseInstructorRole, CourseStaffRole
from openedx.core.djangoapps.course_apps.toggles import proctoring_settings_modal_view_enabled
from openedx.core.djangoapps.discussions.config.waffle import ENABLE_PAGES_AND_RESOURCES_MICROFRONTEND
from openedx.core.djangoapps.discussions.models import DiscussionsConfiguration
from openedx.core.djangoapps.django_comment_common.models import assign_default_role
from openedx.core.djangoapps.django_comment_common.utils import seed_permissions_roles
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
Expand Down Expand Up @@ -753,3 +754,14 @@ def get_subsections_by_assignment_type(course_key):
f'{section.display_name} - {subsection.display_name}'
)
return subsections_by_assignment_type


def update_course_discussions_settings(course_key):
"""
Updates course provider_type when new course is created
"""
provider = DiscussionsConfiguration.get(context_key=course_key).provider_type
store = modulestore()
course = store.get_course(course_key)
course.discussions_settings['provider_type'] = provider
store.update_item(course, course.published_by)
4 changes: 3 additions & 1 deletion cms/djangoapps/contentstore/views/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
reverse_course_url,
reverse_library_url,
reverse_url,
reverse_usage_url
reverse_usage_url,
update_course_discussions_settings,
)
from .component import ADVANCED_COMPONENT_TYPES
from .helpers import is_content_creator
Expand Down Expand Up @@ -992,6 +993,7 @@ def create_new_course(user, org, number, run, fields):
store_for_new_course = modulestore().default_modulestore.get_modulestore_type()
new_course = create_new_course_in_store(store_for_new_course, user, org, number, run, fields)
add_organization_course(org_data, new_course.id)
update_course_discussions_settings(new_course.id)
return new_course


Expand Down

0 comments on commit f08b4d9

Please sign in to comment.