From fbac9e106dd6acf35ba679b106b438a3bbfd191f Mon Sep 17 00:00:00 2001
From: Valery Sizov <vsv2711@gmail.com>
Date: Sat, 21 Nov 2015 18:32:59 +0200
Subject: [PATCH] Award: merge request fix

---
 app/controllers/projects/notes_controller.rb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb
index 1e3f1d8fd2..ead940aea6 100644
--- a/app/controllers/projects/notes_controller.rb
+++ b/app/controllers/projects/notes_controller.rb
@@ -59,8 +59,11 @@ class Projects::NotesController < Projects::ApplicationController
   end
 
   def award_toggle
-    noteable = note_params[:noteable_type] == "issue" ? Issue : MergeRequest
-    noteable = noteable.find_by!(id: note_params[:noteable_id], project: project)
+    noteable = if note_params[:noteable_type] == "issue"
+                 project.issues.find(note_params[:noteable_id])
+               else
+                 project.merge_requests.find(note_params[:noteable_id])
+               end
 
     data = {
       author: current_user,
-- 
2.30.9