summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2014-04-29 17:06:56 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-04-29 17:21:58 +0200
commit0b914e7ceb28c67a50d19c7fac10a95b3ea4a1fa (patch)
tree01ea40d5a274b74fdd64adcb2cc018a0e94082de
parente52f50c22fa0ca855ad75208b511bf27967e92ab (diff)
downloadgitlab-ce-0b914e7ceb28c67a50d19c7fac10a95b3ea4a1fa.tar.gz
Refresh notes when the page becomes visible
-rw-r--r--app/assets/javascripts/notes.js.coffee10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 2599a0ea4fd..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: ->
@@ -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