summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>2016-01-14 17:21:05 -0500
committerJacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>2016-01-14 19:09:46 -0500
commitdaf60957d9823ea09283f0306be69c4e50750397 (patch)
tree0d96d17c7de76fc9887a1a908db63e15b70b1223
parent0192903b238cdbc20752b9db88174c094b19b43a (diff)
downloadgitlab-ce-deleting-a-note-after-editing-another-results-in-a-javascript-error.tar.gz
Fix javascript error with deleting messages in issue or merge requestdeleting-a-note-after-editing-another-results-in-a-javascript-error
Elements searched for by jQuery no longer existed in the DOM. Javascript was also unnecessarily complex, for using jQuery Fixes #8109
-rw-r--r--app/assets/javascripts/notes.js.coffee9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 356fb6aa08c..8866d81c925 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -355,7 +355,7 @@ class @Notes
$('.note[id="' + note_id + '"]').each ->
note = $(this)
notes = note.closest(".notes")
- count = notes.closest(".notes_holder").find(".discussion-notes-count")
+ count = notes.closest(".issuable-details").find(".notes-tab .badge")
# check if this is the last note for this line
if notes.find(".note").length is 1
@@ -365,9 +365,10 @@ class @Notes
# for diff lines
notes.closest("tr").remove()
- else
- # update notes count
- count.get(0).lastChild.nodeValue = " #{notes.children().length - 1}"
+
+ # update notes count
+ oldNum = parseInt(count.text())
+ count.text(oldNum - 1)
note.remove()