@expect_json
@login_required
def cohort_discussion_topics(request, course_key_string):
 course_key = CourseKey.from_string(course_key_string)
 course = get_course_with_access(request.user, 'staff', course_key)
 discussion_topics = {}
 discussion_category_map = get_discussion_category_map(course, request.user, cohorted_if_in_list=True, exclude_unstarted=False)
 course_wide_entries = discussion_category_map.pop('entries')
 course_wide_children = []
 inline_children = []
 for (name, c_type) in discussion_category_map['children']:
  if ((name in course_wide_entries) and (c_type == TYPE_ENTRY)):
   course_wide_children.append([name, c_type])
  else:
   inline_children.append([name, c_type])
 discussion_topics['course_wide_discussions'] = {'entries': course_wide_entries, 'children': course_wide_children}
 discussion_category_map['children'] = inline_children
 discussion_topics['inline_discussions'] = discussion_category_map
 return JsonResponse(discussion_topics)

@ expect_json @ login_required def cohort_discussion_topics ( request , course_key_string ) : course_key = CourseKey . from_string ( course_key_string ) course = get_course_with_access ( request . user , 'staff' , course_key ) discussion_topics = { } discussion_category_map = get_discussion_category_map ( course , request . user , cohorted_if_in_list = True , exclude_unstarted = False ) course_wide_entries = discussion_category_map . pop ( 'entries' ) course_wide_children = [ ] inline_children = [ ] for ( name , c_type ) in discussion_category_map [ 'children' ] : if ( ( name in course_wide_entries ) and ( c_type == TYPE_ENTRY ) ) : course_wide_children . append ( [ name , c_type ] ) else : inline_children . append ( [ name , c_type ] ) discussion_topics [ 'course_wide_discussions' ] = { 'entries' : course_wide_entries , 'children' : course_wide_children } discussion_category_map [ 'children' ] = inline_children discussion_topics [ 'inline_discussions' ] = discussion_category_map return JsonResponse ( discussion_topics )
the handler for cohort discussion categories requests .