提交 dc55127c 编写于 作者: D Dmitriy Zaporozhets

Merge branch 'refresh_unless_hidden' into 'master'

Refresh Notes unless the tab is hidden
......@@ -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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册