From fcbd4bd1cd5ed1b83cd000f3f58fa4d45beeddcc Mon Sep 17 00:00:00 2001 From: Kevin Chugh Date: Sat, 2 Feb 2013 05:46:11 -0500 Subject: [PATCH] produce and consume group_id from dropdowns --- .../django_comment_client/base/views.py | 23 +++++++++++-------- .../django_comment_client/forum/views.py | 2 -- lms/djangoapps/django_comment_client/utils.py | 2 +- lms/templates/discussion/_new_post.html | 2 +- .../discussion/_underscore_templates.html | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lms/djangoapps/django_comment_client/base/views.py b/lms/djangoapps/django_comment_client/base/views.py index ce53a8efbb..604fe60282 100644 --- a/lms/djangoapps/django_comment_client/base/views.py +++ b/lms/djangoapps/django_comment_client/base/views.py @@ -86,27 +86,32 @@ def create_thread(request, course_id, commentable_id): 'anonymous_to_peers' : anonymous_to_peers, 'commentable_id' : commentable_id, 'course_id' : course_id, - 'user_id' : request.user.id, + 'user_id' : request.user.id }) user = cc.User.from_django_user(request.user) + #kevinchugh because the new requirement is that all groups will be determined + #by the group id in the request this all goes away + # Cohort the thread if the commentable is cohorted. - if is_commentable_cohorted(course_id, commentable_id): - user_group_id = get_cohort_id(user, course_id) + #if is_commentable_cohorted(course_id, commentable_id): + # user_group_id = get_cohort_id(user, course_id) # TODO (vshnayder): once we have more than just cohorts, we'll want to # change this to a single get_group_for_user_and_commentable function # that can do different things depending on the commentable_id - if cached_has_permission(request.user, "see_all_cohorts", course_id): + # if cached_has_permission(request.user, "see_all_cohorts", course_id): # admins can optionally choose what group to post as - group_id = post.get('group_id', user_group_id) - else: + # group_id = post.get('group_id', user_group_id) + # else: # regular users always post with their own id. - group_id = user_group_id - thread.update_attributes(group_id=group_id) - + # group_id = user_group_id + if post['group_id']: + thread.update_attributes(group_id=post['group_id']) + thread.save() + print thread if post.get('auto_subscribe', 'false').lower() == 'true': user = cc.User.from_django_user(request.user) user.follow(thread) diff --git a/lms/djangoapps/django_comment_client/forum/views.py b/lms/djangoapps/django_comment_client/forum/views.py index c92324cbbb..fa07394c90 100644 --- a/lms/djangoapps/django_comment_client/forum/views.py +++ b/lms/djangoapps/django_comment_client/forum/views.py @@ -178,8 +178,6 @@ def forum_form_discussion(request, course_id): 'is_course_cohorted': is_course_cohorted(course_id) } # print "start rendering.." - print "\n\n\n\n*******************************" - print context return render_to_response('discussion/index.html', context) @login_required diff --git a/lms/djangoapps/django_comment_client/utils.py b/lms/djangoapps/django_comment_client/utils.py index 3c9669ac37..07d8ef9660 100644 --- a/lms/djangoapps/django_comment_client/utils.py +++ b/lms/djangoapps/django_comment_client/utils.py @@ -374,7 +374,7 @@ def safe_content(content): 'updated_at', 'depth', 'type', 'commentable_id', 'comments_count', 'at_position_list', 'children', 'highlighted_title', 'highlighted_body', 'courseware_title', 'courseware_url', 'tags', 'unread_comments_count', - 'read', + 'read', 'group_id' ] if (content.get('anonymous') is False) and (content.get('anonymous_to_peers') is False): diff --git a/lms/templates/discussion/_new_post.html b/lms/templates/discussion/_new_post.html index 5b55d409df..a009f19350 100644 --- a/lms/templates/discussion/_new_post.html +++ b/lms/templates/discussion/_new_post.html @@ -52,7 +52,7 @@
Make visible to: