summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-12-11 12:49:55 -0500
committerRobert Speicher <rspeicher@gmail.com>2015-12-11 12:49:55 -0500
commit48eccdb2fcfa28c2ab602b76b97ff064195bb113 (patch)
tree861f99f97ed5f1dbab67cbb14c71f05e73299e54 /app/assets
parenta2a68858c88151ce0d77f602dbae59d595495ac6 (diff)
parent1a9d6ec71eafddf8cd6542b47b5473a6a3ba19b9 (diff)
downloadgitlab-ce-48eccdb2fcfa28c2ab602b76b97ff064195bb113.tar.gz
Merge branch 'fix-delete-notes-on-merge-request-diff' into 'master'
Fix delete notes on merge request diff Fixes #3971 See merge request !2061
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/notes.js.coffee24
1 files changed, 16 insertions, 8 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index a7d720fff4b..35dc7829da2 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -350,18 +350,26 @@ class @Notes
###
removeNote: ->
note = $(this).closest(".note")
- notes = note.closest(".notes")
+ note_id = note.attr('id')
- # check if this is the last note for this line
- if notes.find(".note").length is 1
+ $('.note[id="' + note_id + '"]').each ->
+ note = $(this)
+ notes = note.closest(".notes")
+ count = notes.closest(".notes_holder").find(".discussion-notes-count")
- # for discussions
- notes.closest(".discussion").remove()
+ # check if this is the last note for this line
+ if notes.find(".note").length is 1
- # for diff lines
- notes.closest("tr").remove()
+ # for discussions
+ notes.closest(".discussion").remove()
- note.remove()
+ # for diff lines
+ notes.closest("tr").remove()
+ else
+ # update notes count
+ count.get(0).lastChild.nodeValue = " #{notes.children().length - 1}"
+
+ note.remove()
###
Called in response to clicking the delete attachment link