From 0b1cf50060de0d0a3039dfb2fca47364c7fb5f82 Mon Sep 17 00:00:00 2001
From: Ali Tavakoli <ali.tavakoli@gmail.com>
Date: Wed, 9 Jul 2014 14:45:13 -0400
Subject: [PATCH] Added .closest() to find Reply button on click; fixes #401

This is to fix the issue where the icon-comment icon is clicked in the
Reply button of a note; the icon is used as the target and incorrectly
assumed to be the button itself, which causes the reply form to spawn
inside the button.
---
 CHANGELOG                              | 1 +
 app/assets/javascripts/notes.js.coffee | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 45383d97780..f6843aaa6a9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -19,6 +19,7 @@ v 7.1.0
   - Fix LDAP TLS authentication (Boris HUISGEN)
   - Show VERSION information on project sidebar
   - Improve branch removal logic when accept MR
+  - Fix bug where comment form is spawned inside the Reply button
 
 v 7.0.0
   - The CPU no longer overheats when you hold down the spacebar
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 91a4ccaba43..607b109dc0b 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -376,7 +376,7 @@ class Notes
   ###
   replyToDiscussionNote: (e) =>
     form = $(".js-new-note-form")
-    replyLink = $(e.target)
+    replyLink = $(e.target).closest(".js-discussion-reply-button")
     replyLink.hide()
 
     # insert the form after the button
-- 
GitLab