diff options
author | Fatih Acet <acetfatih@gmail.com> | 2018-02-28 00:10:43 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2018-02-28 00:10:43 +0000 |
commit | 059ab73b8eae3a546d0a19fe99ef0c52df5fac01 (patch) | |
tree | b24d4162072c0099147fcdb4f19f95511689ff6e /app/controllers/projects/notes_controller.rb | |
parent | 0be4a77d0012613f960c4177f53101c46de2899c (diff) | |
download | gitlab-ce-059ab73b8eae3a546d0a19fe99ef0c52df5fac01.tar.gz |
Render MR Notes with Vue with behind a cookie
Diffstat (limited to 'app/controllers/projects/notes_controller.rb')
-rw-r--r-- | app/controllers/projects/notes_controller.rb | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index 4f8978c93c3..dd41b9648e8 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -1,5 +1,6 @@ class Projects::NotesController < Projects::ApplicationController include NotesActions + include NotesHelper include ToggleAwardEmoji before_action :whitelist_query_limiting, only: [:create] @@ -38,10 +39,14 @@ class Projects::NotesController < Projects::ApplicationController discussion = note.discussion - render json: { - resolved_by: note.resolved_by.try(:name), - discussion_headline_html: (view_to_html_string('discussions/_headline', discussion: discussion) if discussion) - } + if serialize_notes? + render_json_with_notes_serializer + else + render json: { + resolved_by: note.resolved_by.try(:name), + discussion_headline_html: (view_to_html_string('discussions/_headline', discussion: discussion) if discussion) + } + end end def unresolve @@ -51,16 +56,27 @@ class Projects::NotesController < Projects::ApplicationController discussion = note.discussion - render json: { - discussion_headline_html: (view_to_html_string('discussions/_headline', discussion: discussion) if discussion) - } + if serialize_notes? + render_json_with_notes_serializer + else + render json: { + discussion_headline_html: (view_to_html_string('discussions/_headline', discussion: discussion) if discussion) + } + end end private + def render_json_with_notes_serializer + Notes::RenderService.new(current_user).execute([note], project) + + render json: note_serializer.represent(note) + end + def note @note ||= @project.notes.find(params[:id]) end + alias_method :awardable, :note def finder_params |