Commit 0b914e7c authored by Jacob Vosmaer's avatar Jacob Vosmaer

Refresh notes when the page becomes visible

parent e52f50c2
...@@ -50,6 +50,9 @@ class Notes ...@@ -50,6 +50,9 @@ class Notes
# hide diff note form # hide diff note form
$(document).on "click", ".js-close-discussion-note-form", @cancelDiscussionForm $(document).on "click", ".js-close-discussion-note-form", @cancelDiscussionForm
# fetch notes when tab becomes visible
$(document).on "visibilitychange", @visibilityChange
cleanBinding: -> cleanBinding: ->
$(document).off "ajax:success", ".js-main-target-form" $(document).off "ajax:success", ".js-main-target-form"
$(document).off "ajax:success", ".js-discussion-note-form" $(document).off "ajax:success", ".js-discussion-note-form"
...@@ -63,6 +66,7 @@ class Notes ...@@ -63,6 +66,7 @@ class Notes
$(document).off "click", ".js-choose-note-attachment-button" $(document).off "click", ".js-choose-note-attachment-button"
$(document).off "click", ".js-discussion-reply-button" $(document).off "click", ".js-discussion-reply-button"
$(document).off "click", ".js-add-diff-note-button" $(document).off "click", ".js-add-diff-note-button"
$(document).off "visibilitychange"
initRefresh: -> initRefresh: ->
...@@ -453,4 +457,10 @@ class Notes ...@@ -453,4 +457,10 @@ class Notes
filename = $(this).val().replace(/^.*[\\\/]/, "") filename = $(this).val().replace(/^.*[\\\/]/, "")
form.find(".js-attachment-filename").text filename form.find(".js-attachment-filename").text filename
###
Called when the tab visibility changes
###
visibilityChange: =>
@refresh()
@Notes = Notes @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