Commit c3c849927d42c4ba5431b3970dab63fdb89b77f5

Authored by Dmitriy Zaporozhets
1 parent c78393ec

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 1 var NoteList = {
2   -
  2 + id: null,
3 3 notes_path: null,
4 4 target_params: null,
5 5 target_id: 0,
... ... @@ -16,6 +16,16 @@ var NoteList = {
16 16 // get initial set of notes
17 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 29 // add a new diff note
20 30 $(document).on("click",
21 31 ".js-add-diff-note-button",
... ...