Skip to content

Commit

Permalink
Allow for us of the old commentable_id if the user does not select a …
Browse files Browse the repository at this point in the history
…topic.
  • Loading branch information
Kelketek committed Jan 21, 2015
1 parent b8525be commit 9835d67
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lms/djangoapps/django_comment_client/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ def update_thread(request, course_id, thread_id):
if "commentable_id" in request.POST:
course = get_course_with_access(request.user, 'load', course_key)
commentable_ids = get_discussion_categories_ids(course)
# The commentable ID on thread creation may not be available in the
# topic menu, such as when the thread is concerning the current
# unit in context. In this case the topic menu will be blank, but the
# old commentable_id will be sent.
try:
commentable_ids.append(thread.commentable_id)
except AttributeError:
pass
if request.POST.get("commentable_id") in commentable_ids:
thread.commentable_id = request.POST["commentable_id"]
else:
Expand Down

0 comments on commit 9835d67

Please sign in to comment.