diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/assets/javascripts/notes.js.coffee | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index 1922abe572f..1e9aeefd19a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ v 6.9.0 - Add ability to set different ssh host, if different from http/https - Fix syntax highlighting for code comments blocks - Improve comments loading logic + - Stop refreshing comments when the tab is hidden v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index 043e4f62666..8b152005639 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -50,6 +50,9 @@ class Notes # hide diff note form $(document).on "click", ".js-close-discussion-note-form", @cancelDiscussionForm + # fetch notes when tab becomes visible + $(document).on "visibilitychange", @visibilityChange + cleanBinding: -> $(document).off "ajax:success", ".js-main-target-form" $(document).off "ajax:success", ".js-discussion-note-form" @@ -63,6 +66,7 @@ class Notes $(document).off "click", ".js-choose-note-attachment-button" $(document).off "click", ".js-discussion-reply-button" $(document).off "click", ".js-add-diff-note-button" + $(document).off "visibilitychange" initRefresh: -> @@ -72,7 +76,7 @@ class Notes , 15000 refresh: -> - @getContent() + @getContent() unless document.hidden getContent: -> $.ajax @@ -453,4 +457,10 @@ class Notes filename = $(this).val().replace(/^.*[\\\/]/, "") form.find(".js-attachment-filename").text filename + ### + Called when the tab visibility changes + ### + visibilityChange: => + @refresh() + @Notes = Notes |