diff --git a/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee b/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee index 407f540a61..21a3171d28 100644 --- a/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee +++ b/lms/static/coffee/src/discussion/views/discussion_thread_view.coffee @@ -122,9 +122,9 @@ class @DiscussionThreadView extends DiscussionContentView body = @getWmdContent("reply-body") return if not body.trim().length @setWmdContent("reply-body", "") - response = new Comment(body: body, created_at: (new Date()).toISOString(), username: window.user.get("username"), votes: { up_count: 0 }, endorsed: false, user_id: window.user.get("id")) - response.set('thread', @model.get('thread')) - @renderResponse(response) + comment = new Comment(body: body, created_at: (new Date()).toISOString(), username: window.user.get("username"), votes: { up_count: 0 }, endorsed: false, user_id: window.user.get("id")) + comment.set('thread', @model.get('thread')) + @renderResponse(comment) @model.addComment() DiscussionUtil.safeAjax @@ -134,9 +134,13 @@ class @DiscussionThreadView extends DiscussionContentView dataType: 'json' data: body: body + success: (data, textStatus) => + comment.updateInfo(data.annotated_content_info) + comment.set(data.content) edit: -> + delete: (event) -> url = @model.urlFor('delete') if not @model.can('can_delete')