From 6c6f415cae54be4dae4522e901ed55c9dae04a15 Mon Sep 17 00:00:00 2001
From: Riyad Preukschas <riyad@informatik.uni-bremen.de>
Date: Mon, 29 Oct 2012 19:37:37 +0100
Subject: [PATCH] Fix appending diff line notes

---
 app/contexts/notes/create_context.rb          | 4 ++--
 app/views/notes/_create_per_line_note.js.haml | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/contexts/notes/create_context.rb b/app/contexts/notes/create_context.rb
index d93adb835e..1367dff469 100644
--- a/app/contexts/notes/create_context.rb
+++ b/app/contexts/notes/create_context.rb
@@ -3,8 +3,8 @@ module Notes
     def execute
       note = project.notes.new(params[:note])
       note.author = current_user
-      note.notify = true if params[:notify] == '1'
-      note.notify_author = true if params[:notify_author] == '1'
+      note.notify = params[:notify].present?
+      note.notify_author = params[:notify_author].present?
       note.save
       note
     end
diff --git a/app/views/notes/_create_per_line_note.js.haml b/app/views/notes/_create_per_line_note.js.haml
index eea9eb38be..6f74699996 100644
--- a/app/views/notes/_create_per_line_note.js.haml
+++ b/app/views/notes/_create_per_line_note.js.haml
@@ -6,7 +6,7 @@
 
     // find the reply button for this line
     // (might not be there if this is the first note)
-    var trRpl = $("a.line_note_reply_link[data-line-code='#{note.line_code}']").closest("tr");
+    var trRpl = $("a.line_note_reply_link[data-noteable-type='#{note.noteable_type}'][data-noteable-id='#{note.noteable_id}'][data-line-code='#{note.line_code}']").closest("tr");
     if (trRpl.size() == 0) {
       // find the commented line ...
       var trEl = $(".#{note.line_code}").parent();
-- 
2.30.9