From 4e00e5b358db9114cd19e37e93db84906589f114 Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Wed, 11 Oct 2023 23:48:25 +0200 Subject: [PATCH] Add notifications-permissions-error to translations --- public/lang/en.json | 1 + public/scripts/ui.js | 10 ++-------- public_included_ws_fallback/lang/en.json | 1 + public_included_ws_fallback/scripts/ui.js | 10 ++-------- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/public/lang/en.json b/public/lang/en.json index a7a8e60..93e5156 100644 --- a/public/lang/en.json +++ b/public/lang/en.json @@ -119,6 +119,7 @@ "file-content-incorrect": "File content is incorrect.", "clipboard-content-incorrect": "Clipboard content is incorrect.", "notifications-enabled": "Notifications enabled.", + "notifications-permissions-error": "Notifications permission has been blocked as the user has dismissed the permission prompt several times. This can be reset in Page Info which can be accessed by clicking the lock icon next to the URL.", "link-received": "Link received by {{name}} - Click to open", "message-received": "Message received by {{name}} - Click to copy", "click-to-download": "Click to download", diff --git a/public/scripts/ui.js b/public/scripts/ui.js index 20767e2..f8bdf38 100644 --- a/public/scripts/ui.js +++ b/public/scripts/ui.js @@ -2071,11 +2071,11 @@ class Notifications { _requestPermission() { Notification.requestPermission(permission => { if (permission !== 'granted') { - Events.fire('notify-user', Notifications.PERMISSION_ERROR || 'Error'); + Events.fire('notify-user', Localization.getTranslation("notifications.notifications-permissions-error")); return; } Events.fire('notify-user', Localization.getTranslation("notifications.notifications-enabled")); - this.$button.setAttribute('hidden', 1); + this.$button.setAttribute('hidden', ""); }); } @@ -2783,9 +2783,3 @@ window.addEventListener("keydown", (e) => { window.location.hash = '#'; } }); - -Notifications.PERMISSION_ERROR = ` -Notifications permission has been blocked -as the user has dismissed the permission prompt several times. -This can be reset in Page Info -which can be accessed by clicking the lock icon next to the URL.`; diff --git a/public_included_ws_fallback/lang/en.json b/public_included_ws_fallback/lang/en.json index a7a8e60..93e5156 100644 --- a/public_included_ws_fallback/lang/en.json +++ b/public_included_ws_fallback/lang/en.json @@ -119,6 +119,7 @@ "file-content-incorrect": "File content is incorrect.", "clipboard-content-incorrect": "Clipboard content is incorrect.", "notifications-enabled": "Notifications enabled.", + "notifications-permissions-error": "Notifications permission has been blocked as the user has dismissed the permission prompt several times. This can be reset in Page Info which can be accessed by clicking the lock icon next to the URL.", "link-received": "Link received by {{name}} - Click to open", "message-received": "Message received by {{name}} - Click to copy", "click-to-download": "Click to download", diff --git a/public_included_ws_fallback/scripts/ui.js b/public_included_ws_fallback/scripts/ui.js index a6d44fb..db2facc 100644 --- a/public_included_ws_fallback/scripts/ui.js +++ b/public_included_ws_fallback/scripts/ui.js @@ -2073,11 +2073,11 @@ class Notifications { _requestPermission() { Notification.requestPermission(permission => { if (permission !== 'granted') { - Events.fire('notify-user', Notifications.PERMISSION_ERROR || 'Error'); + Events.fire('notify-user', Localization.getTranslation("notifications.notifications-permissions-error")); return; } Events.fire('notify-user', Localization.getTranslation("notifications.notifications-enabled")); - this.$button.setAttribute('hidden', 1); + this.$button.setAttribute('hidden', ""); }); } @@ -2784,9 +2784,3 @@ window.addEventListener("keydown", (e) => { window.location.hash = '#'; } }); - -Notifications.PERMISSION_ERROR = ` -Notifications permission has been blocked -as the user has dismissed the permission prompt several times. -This can be reset in Page Info -which can be accessed by clicking the lock icon next to the URL.`;