mirror of
https://github.com/zulip/zulip.git
synced 2025-11-18 04:43:58 +00:00
Set focus-related flags correctly after a server reload
(imported from commit 408469c0da0cfa5513e6838329816cd88665981f)
This commit is contained in:
@@ -17,7 +17,9 @@ var OFFLINE_THRESHOLD_SECS = 140;
|
||||
exports.ACTIVE = "active";
|
||||
exports.IDLE = "idle";
|
||||
|
||||
exports.has_focus = true;
|
||||
// When you start Zulip, has_focus should be true, but it might not be the
|
||||
// case after a server-initiated reload.
|
||||
exports.has_focus = document.hasFocus && document.hasFocus();
|
||||
|
||||
// We initialize this to true, to count new page loads, but set it to
|
||||
// false in the onload function in reload.js if this was a
|
||||
|
||||
@@ -3,7 +3,11 @@ var notifications = (function () {
|
||||
var exports = {};
|
||||
|
||||
var notice_memory = {};
|
||||
var window_has_focus = true;
|
||||
|
||||
// When you start Zulip, window_has_focus should be true, but it might not be the
|
||||
// case after a server-initiated reload.
|
||||
var window_has_focus = document.hasFocus && document.hasFocus();
|
||||
|
||||
var asked_permission_already = false;
|
||||
var names;
|
||||
var supports_sound;
|
||||
|
||||
@@ -14,6 +14,12 @@ set_global('$', function () {
|
||||
};
|
||||
});
|
||||
|
||||
set_global('document', {
|
||||
hasFocus: function () {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
var activity = require('js/activity.js');
|
||||
|
||||
(function test_sort_users() {
|
||||
|
||||
Reference in New Issue
Block a user