Commit 68baafb8 by Ibrahim Awwal Committed by Matthew Mongeau

Oops, this was needed for replies to be rendered in the main forum view.

parent b64236f6
......@@ -236,7 +236,6 @@ def render_single_thread(request, discussion_id, course_id, thread_id):
def single_thread(request, course_id, discussion_id, thread_id):
<<<<<<< HEAD
try:
if request.is_ajax():
......@@ -287,56 +286,6 @@ def single_thread(request, course_id, discussion_id, thread_id):
return render_to_response('discussion/single_thread.html', context)
except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError) as err:
raise Http404
=======
if request.is_ajax():
user_info = cc.User.from_django_user(request.user).to_dict()
thread = cc.Thread.find(thread_id).retrieve(recursive=True)
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)
return utils.JsonResponse({
# 'html': html,
'content': utils.safe_content(thread.to_dict()),
'annotated_content_info': annotated_content_info,
})
else:
course = get_course_with_access(request.user, course_id, 'load')
category_map = utils.get_discussion_category_map(course)
threads, query_params = get_threads(request, course_id)
recent_active_threads = cc.search_recent_active_threads(
course_id,
recursive=False,
query_params={'follower_id': request.user.id},
)
trending_tags = cc.search_trending_tags(
course_id,
)
user_info = cc.User.from_django_user(request.user).to_dict()
escapedict = {'"': '&quot;'}
context = {
'discussion_id': discussion_id,
'csrf': csrf(request)['csrf_token'],
'init': '',
'user_info': saxutils.escape(json.dumps(user_info),escapedict),
'content': render_single_thread(request, discussion_id, course_id, thread_id),
'course': course,
'recent_active_threads': recent_active_threads,
'trending_tags': trending_tags,
'course_id': course.id,
'thread_id': thread_id,
'threads': saxutils.escape(json.dumps(threads), escapedict),
'category_map': category_map,
}
return render_to_response('discussion/single_thread.html', context)
>>>>>>> Refactor some things more and make the forum index sort of work, although the sticky sidebar is broken, probably because there's no content in the thread view pane.
def user_profile(request, course_id, user_id):
......
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