Commit 0f0a96ab authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'mr-improve-comments' into 'master'

Improve merge request comments

Fixes #1338
parents 14bc7e05 30912c75
...@@ -142,8 +142,15 @@ class Notes ...@@ -142,8 +142,15 @@ class Notes
# remove the note (will be added again below) # remove the note (will be added again below)
row.next().find(".note").remove() row.next().find(".note").remove()
# append new note to all matching discussions # Add note to 'Changes' page discussions
$(".notes[rel='" + note.discussion_id + "']").append note.html $(".notes[rel='" + note.discussion_id + "']").append note.html
# Init discussion on 'Discussion' page
$('ul.main-notes-list').append(note.discussion_with_diff_html)
else
# append new note to all matching discussions
$(".notes[rel='" + note.discussion_id + "']").append note.html
# cleanup after successfully creating a diff/discussion note # cleanup after successfully creating a diff/discussion note
@removeDiscussionNoteForm(form) @removeDiscussionNoteForm(form)
......
...@@ -85,12 +85,22 @@ class Projects::NotesController < Projects::ApplicationController ...@@ -85,12 +85,22 @@ class Projects::NotesController < Projects::ApplicationController
) )
end end
def note_to_discussion_with_diff_html(note)
render_to_string(
"projects/notes/_discussion",
layout: false,
formats: [:html],
locals: { discussion_notes: [note] }
)
end
def render_note_json(note) def render_note_json(note)
render json: { render json: {
id: note.id, id: note.id,
discussion_id: note.discussion_id, discussion_id: note.discussion_id,
html: note_to_html(note), html: note_to_html(note),
discussion_html: note_to_discussion_html(note) discussion_html: note_to_discussion_html(note),
discussion_with_diff_html: note_to_discussion_with_diff_html(note)
} }
end end
......
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