From a8beb2a807ce9f9ec1cfccd2ee5df8382786944f Mon Sep 17 00:00:00 2001 From: Ibrahim Awwal Date: Mon, 10 Sep 2012 19:46:44 -0700 Subject: [PATCH] Add context link to threads rendered via AJAX. --- lms/djangoapps/django_comment_client/forum/views.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/django_comment_client/forum/views.py b/lms/djangoapps/django_comment_client/forum/views.py index 70ec49e4d8..f0565c56ac 100644 --- a/lms/djangoapps/django_comment_client/forum/views.py +++ b/lms/djangoapps/django_comment_client/forum/views.py @@ -265,22 +265,24 @@ def render_single_thread(request, discussion_id, course_id, thread_id): def single_thread(request, course_id, discussion_id, thread_id): if request.is_ajax(): - + course = get_course_with_access(request.user, course_id, 'load') user_info = cc.User.from_django_user(request.user).to_dict() try: thread = cc.Thread.find(thread_id).retrieve(recursive=True) except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError) as err: raise Http404 + courseware_context = get_courseware_context(thread, course) annotated_content_info = utils.get_annotated_content_infos(course_id, thread, request.user, user_info=user_info) context = {'thread': thread.to_dict(), 'course_id': course_id} # TODO: Remove completely or switch back to server side rendering html = render_to_string('discussion/_ajax_single_thread.html', context) - + content = utils.safe_content(thread.to_dict()) + content.update(courseware_context) return utils.JsonResponse({ 'html': html, - 'content': utils.safe_content(thread.to_dict()), + 'content': content, 'annotated_content_info': annotated_content_info, })