diff options
author | Robert Speicher <robert@gitlab.com> | 2016-01-15 04:27:24 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-01-15 04:27:24 +0000 |
commit | f093d8ccb4101e160bf2a89ec1f9ebe9d73f84fc (patch) | |
tree | 0be11a1205141e254c87e62a84a1c44c736faa4b | |
parent | 041ca926e0b6c8ae1b9ac66fd3432dd40d0592af (diff) | |
parent | daf60957d9823ea09283f0306be69c4e50750397 (diff) | |
download | gitlab-ce-f093d8ccb4101e160bf2a89ec1f9ebe9d73f84fc.tar.gz |
Merge branch 'deleting-a-note-after-editing-another-results-in-a-javascript-error' into 'master'
Fix javascript error with deleting messages in issue or merge request
Elements searched for by jQuery no longer existed in the DOM.
Javascript was also unnecessarily complex, for using jQuery
Fixes #8109
See merge request !2442
-rw-r--r-- | app/assets/javascripts/notes.js.coffee | 9 |
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() |