From dbb63cb52443c497af2ee71d588c99bdf8cbafec Mon Sep 17 00:00:00 2001 From: Jeff Arnold Date: Tue, 8 Jan 2013 10:54:44 -0500 Subject: [PATCH] Don't continuously bug user if they dismiss the notifications box Fixes Trac #514 (imported from commit 445af7cf458118be0394491aebbd9996817b08a4) --- zephyr/static/js/notifications.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zephyr/static/js/notifications.js b/zephyr/static/js/notifications.js index cad024e3c9..487563aa18 100644 --- a/zephyr/static/js/notifications.js +++ b/zephyr/static/js/notifications.js @@ -5,6 +5,7 @@ var exports = {}; var notice_memory = {}; var window_has_focus = true; var new_message_count = 0; +var asked_permission_already = false; function browser_desktop_notifications_on () { return (window.webkitNotifications && @@ -30,11 +31,12 @@ exports.initialize = function () { } $(document).click(function () { - if (!desktop_notifications_enabled) { + if (!desktop_notifications_enabled || asked_permission_already) { return; } if (window.webkitNotifications.checkPermission() !== 0) { // 0 is PERMISSION_ALLOWED window.webkitNotifications.requestPermission(); + asked_permission_already = true; } }); };