diff options
author | Ruben Davila <rdavila84@gmail.com> | 2016-11-17 12:21:53 -0500 |
---|---|---|
committer | Ruben Davila <rdavila84@gmail.com> | 2016-11-17 12:21:53 -0500 |
commit | 77e8e9b3296f8f2d17fe2f70a644d5e05f6e7fd2 (patch) | |
tree | 5f3cb9627e911a2725cbf33665f2fcfbb72f5558 /app/controllers/projects/notes_controller.rb | |
parent | aea8baed3093c513560e9ac5ac0c5c99508d3001 (diff) | |
download | gitlab-ce-ee-backport.tar.gz |
Backport some changes done from Time Tracking feature in EE.ee-backport
Diffstat (limited to 'app/controllers/projects/notes_controller.rb')
-rw-r--r-- | app/controllers/projects/notes_controller.rb | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index 0948ad21649..f029fde2a2f 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -146,24 +146,26 @@ class Projects::NotesController < Projects::ApplicationController end def note_json(note) + attrs = { + award: false, + id: note.id + } + if note.is_a?(AwardEmoji) - { + attrs.merge!( valid: note.valid?, award: true, - id: note.id, name: note.name - } + ) elsif note.persisted? Banzai::NoteRenderer.render([note], @project, current_user) - attrs = { + attrs.merge!( valid: true, - id: note.id, discussion_id: note.discussion_id, html: note_html(note), - award: false, note: note.note - } + ) if note.diff_note? discussion = note.to_discussion @@ -188,15 +190,14 @@ class Projects::NotesController < Projects::ApplicationController attrs[:original_discussion_id] = note.original_discussion_id end end - - attrs else - { + attrs.merge!( valid: false, - award: false, errors: note.errors - } + ) end + + attrs end def authorize_admin_note! |