Commit dc55127c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'refresh_unless_hidden' into 'master'

Refresh Notes unless the tab is hidden
parents c7dc20c1 c8cf90d2
......@@ -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
......
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment