diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-11-19 19:12:17 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-11-19 19:12:17 +0300 |
commit | bdf4007cb7b18ed6892455d0a9adf78476188563 (patch) | |
tree | d9db5467ff74c4387777e15a9f0a0bbee6f3e81a /app/controllers/projects/notes_controller.rb | |
parent | 671a49cfd53230b57acf579a609bab958e066982 (diff) |
adressing comments
Diffstat (limited to 'app/controllers/projects/notes_controller.rb')
-rw-r--r-- | app/controllers/projects/notes_controller.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index 8159cc50838..263b8b8d94e 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -59,21 +59,21 @@ class Projects::NotesController < Projects::ApplicationController end def award_toggle - noteable = params[:noteable_type] == "Issue" ? Issue : MergeRequest - noteable = noteable.find(params[:noteable_id]) + noteable = note_params[:noteable_type] == "issue" ? Issue : MergeRequest + noteable = noteable.find_by!(id: note_params[:noteable_id], project: project) + data = { - noteable: noteable, author: current_user, is_award: true, - note: params[:emoji] + note: note_params[:note] } - note = project.notes.find_by(data) + note = noteable.notes.find_by(data) if note note.destroy else - project.notes.create(data) + Notes::CreateService.new(project, current_user, note_params).execute end render json: { ok: true } |