diff options
author | ZJ van de Weg <zegerjan@gitlab.com> | 2016-05-17 20:28:17 +0300 |
---|---|---|
committer | ZJ van de Weg <zegerjan@gitlab.com> | 2016-05-18 16:47:15 +0300 |
commit | e0cabb67d0492907e6cef21bb0ef21a6e953b70b (patch) | |
tree | e6f6f11a0d5cc9246670f76ad84bd0f75d652a6e /app/controllers/projects/notes_controller.rb | |
parent | 7a4e7ad04e1fc96953d9159e8e1a2208990d34f7 (diff) |
Fix latests concerns
Diffstat (limited to 'app/controllers/projects/notes_controller.rb')
-rw-r--r-- | app/controllers/projects/notes_controller.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index eb5137fe999..b097f609c63 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -22,10 +22,8 @@ class Projects::NotesController < Projects::ApplicationController def create @note = Notes::CreateService.new(project, current_user, note_params).execute - @note = @note.is_a?(AwardEmoji) ? @note.to_note_json : note_json(@note) - respond_to do |format| - format.json { render json: @note } + format.json { render json: note_json(@note) } format.html { redirect_back_or_default } end end @@ -109,7 +107,14 @@ class Projects::NotesController < Projects::ApplicationController end def note_json(note) - if note.valid? + if note.is_a?(AwardEmoji) + { + valid: note.valid?, + award: true, + id: note.id, + name: note.name + } + elsif note.valid? { valid: true, id: note.id, |