diff --git a/lms/djangoapps/django_comment_client/utils.py b/lms/djangoapps/django_comment_client/utils.py index 45e0fc196c..516344d79b 100644 --- a/lms/djangoapps/django_comment_client/utils.py +++ b/lms/djangoapps/django_comment_client/utils.py @@ -222,7 +222,7 @@ def extend_content(content): def safe_content(content): fields = [ - 'id', 'body', 'course_id', 'anonymous', 'endorsed', + 'id', 'title', 'body', 'course_id', 'anonymous', 'endorsed', 'parent_id', 'thread_id', 'votes', 'closed', 'created_at', 'updated_at', 'depth', 'type', 'commentable_id', 'comments_count', 'at_position_list', diff --git a/lms/static/coffee/src/discussion/content.coffee b/lms/static/coffee/src/discussion/content.coffee index 95eef8cda8..13d6f1094f 100644 --- a/lms/static/coffee/src/discussion/content.coffee +++ b/lms/static/coffee/src/discussion/content.coffee @@ -316,8 +316,12 @@ if Backbone? success: (response, textStatus) => DiscussionUtil.clearFormErrors @$(".discussion-update-errors") @$discussionContent().replaceWith(response.html) - @model.set response.content - @model.updateInfo response.annotated_content_info + if @model.get('type') == 'thread' + @model = new Thread response.content + else + @model = new Comment $.extend {}, response.content, { thread: @model.get('thread') } + @reconstruct() + @model.updateInfo response.annotated_content_info, { forceUpdate: true } cancelEdit: (event) -> @$(".discussion-content-edit").hide() @@ -388,6 +392,14 @@ if Backbone? @initTitle() @initBody() @initCommentViews() + + reconstruct: -> + @initBindings() + @initLocal() + @initTimeago() + @initTitle() + @initBody() + @delegateEvents() class @Thread extends @Content urlMappers: