Commit c3c849927d42c4ba5431b3970dab63fdb89b77f5
1 parent
c78393ec
Exists in
master
and in
4 other branches
Unbind note events to prevent firing twice with turbolinks
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
app/assets/javascripts/notes.js
| 1 | var NoteList = { | 1 | var NoteList = { |
| 2 | - | 2 | + id: null, |
| 3 | notes_path: null, | 3 | notes_path: null, |
| 4 | target_params: null, | 4 | target_params: null, |
| 5 | target_id: 0, | 5 | target_id: 0, |
| @@ -16,6 +16,16 @@ var NoteList = { | @@ -16,6 +16,16 @@ var NoteList = { | ||
| 16 | // get initial set of notes | 16 | // get initial set of notes |
| 17 | NoteList.getContent(); | 17 | NoteList.getContent(); |
| 18 | 18 | ||
| 19 | + // Unbind events to prevent firing twice | ||
| 20 | + $(document).off("click", ".js-add-diff-note-button"); | ||
| 21 | + $(document).off("click", ".js-discussion-reply-button"); | ||
| 22 | + $(document).off("click", ".js-note-preview-button"); | ||
| 23 | + $(document).off("click", ".js-note-attachment-input"); | ||
| 24 | + $(document).off("click", ".js-close-discussion-note-form"); | ||
| 25 | + $(document).off("click", ".js-note-delete"); | ||
| 26 | + $(document).off("ajax:complete", ".js-main-target-form"); | ||
| 27 | + | ||
| 28 | + | ||
| 19 | // add a new diff note | 29 | // add a new diff note |
| 20 | $(document).on("click", | 30 | $(document).on("click", |
| 21 | ".js-add-diff-note-button", | 31 | ".js-add-diff-note-button", |