From fbeb57874ca9a66798d9bf4ab53ab2a711745376 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Wed, 8 Oct 2014 12:47:23 -0400 Subject: [PATCH] Address code review comments --- lms/djangoapps/django_comment_client/utils.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/django_comment_client/utils.py b/lms/djangoapps/django_comment_client/utils.py index f0f91739c8..84f01176dd 100644 --- a/lms/djangoapps/django_comment_client/utils.py +++ b/lms/djangoapps/django_comment_client/utils.py @@ -17,9 +17,8 @@ from django_comment_client.permissions import check_permissions_by_view, cached_ from edxmako import lookup_template import pystache_custom as pystache -from course_groups.cohorts import get_cohort_by_id, get_cohort_id, is_commentable_cohorted +from course_groups.cohorts import get_cohort_by_id, get_cohort_id, is_commentable_cohorted, is_course_cohorted from course_groups.models import CourseUserGroup -from courseware.courses import get_course_by_id from opaque_keys.edx.locations import i4xEncoder from opaque_keys.edx.keys import CourseKey from xmodule.modulestore.django import modulestore @@ -395,7 +394,6 @@ def prepare_content(content, course_key, is_staff=False): @TODO: not all response pre-processing steps are currently integrated into this function. """ - course = get_course_by_id(course_key) fields = [ 'id', 'title', 'body', 'course_id', 'anonymous', 'anonymous_to_peers', @@ -429,7 +427,7 @@ def prepare_content(content, course_key, is_staff=False): # Only reveal endorser if requester can see author or if endorser is staff if ( endorser and - ("username" in fields or cached_has_permission(endorser, "endorse_comment", course_id)) + ("username" in fields or cached_has_permission(endorser, "endorse_comment", course_key)) ): endorsement["username"] = endorser.username else: @@ -442,7 +440,7 @@ def prepare_content(content, course_key, is_staff=False): ] content[child_content_key] = children - if course.is_cohorted: + if is_course_cohorted(course_key): # Augment the specified thread info to include the group name if a group id is present. if content.get('group_id') is not None: content['group_name'] = get_cohort_by_id(course_key, content.get('group_id')).name