File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
lms/djangoapps/discussion/rest_api Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -1957,10 +1957,13 @@ def get_course_discussion_user_stats(
19571957
19581958 # Exclude banned users from the learners list
19591959 # Get all active bans for this course using forum API
1960- banned_usernames = forum_api .get_banned_usernames (
1961- course_id = course_key ,
1962- org_key = course_key .org
1963- )
1960+ get_banned_usernames = getattr (forum_api , 'get_banned_usernames' , None )
1961+ banned_usernames = []
1962+ if get_banned_usernames :
1963+ banned_usernames = get_banned_usernames (
1964+ course_id = course_key ,
1965+ org_key = course_key .org
1966+ )
19641967
19651968 # Filter out banned users from the stats
19661969 if banned_usernames :
Original file line number Diff line number Diff line change @@ -328,7 +328,10 @@ def get_author_ban_scope(self, obj):
328328 if isinstance (course_id , str ):
329329 course_id = CourseKey .from_string (course_id )
330330
331- return forum_api .get_user_ban_scope (user , course_id )
331+ get_user_ban_scope = getattr (forum_api , 'get_user_ban_scope' , None )
332+ if get_user_ban_scope :
333+ return get_user_ban_scope (user , course_id )
334+ return None
332335 except (ObjectDoesNotExist , ValueError , Exception ): # pylint: disable=broad-exception-caught
333336 return None
334337
You can’t perform that action at this time.
0 commit comments