Commit 07baaec6 by Jonathan Piacenti

Fix inline discussion cohort display when no longer cohorted.

parent 4a08e99b
...@@ -153,12 +153,12 @@ def get_threads(request, course_key, discussion_id=None, per_page=THREADS_PER_PA ...@@ -153,12 +153,12 @@ def get_threads(request, course_key, discussion_id=None, per_page=THREADS_PER_PA
return threads, query_params return threads, query_params
def _set_group_names(course_id, threads): def _set_group_names(course, threads):
""" Adds group name if the thread has a group id""" """ Adds group name if the thread has a group id"""
for thread in threads: for thread in threads:
if thread.get('group_id'): if thread.get('group_id') and is_course_cohorted(course):
thread['group_name'] = get_cohort_by_id(course_id, thread.get('group_id')).name thread['group_name'] = get_cohort_by_id(course, thread.get('group_id')).name
thread['group_string'] = "This post visible only to Group %s." % (thread['group_name']) thread['group_string'] = "This post visible only to Group %s." % (thread['group_name'])
else: else:
thread['group_name'] = "" thread['group_name'] = ""
...@@ -496,7 +496,7 @@ def followed_threads(request, course_key, user_id): ...@@ -496,7 +496,7 @@ def followed_threads(request, course_key, user_id):
query_params['group_id'] = group_id query_params['group_id'] = group_id
threads, page, num_pages = profiled_user.subscribed_threads(query_params) threads, page, num_pages = profiled_user.subscribed_threads(query_params)
threads = _set_group_names(course_key, threads) threads = _set_group_names(course, threads)
query_params['page'] = page query_params['page'] = page
query_params['num_pages'] = num_pages query_params['num_pages'] = num_pages
user_info = cc.User.from_django_user(request.user).to_dict() user_info = cc.User.from_django_user(request.user).to_dict()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment