diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-06-13 23:23:38 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-06-13 23:23:38 +0300 |
commit | e20aa4581b0d17eae36d9722ee8789af47f57727 (patch) | |
tree | 36c4cbf3ce74b229dd5eacf06e2cb99f79870996 /app | |
parent | 6aefd3c3213277d80e0680809b45643ef19df4d0 (diff) |
Fix note polling when a window has been hidden
`refresh` was called, `refreshing` was set to true, but then because
`document.hidden` was true, `getContent` was never called, and
`refreshing` never got reset to `false`, which stopped polling entirely
until refresh.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/notes.js.coffee | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index ad216910c8d..e2d3241437b 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -115,12 +115,14 @@ class @Notes , @pollingInterval refresh: => - return if @refreshing is true - @refreshing = true if not document.hidden and document.URL.indexOf(@noteable_url) is 0 @getContent() getContent: -> + return if @refreshing + + @refreshing = true + $.ajax url: @notes_url data: "last_fetched_at=" + @last_fetched_at |