summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKohei Yoshino <kohei.yoshino@gmail.com>2018-07-31 19:44:30 +0200
committerDylan William Hardison <dylan@hardison.net>2018-07-31 19:44:30 +0200
commitd133f849672bdd7ad1b22e2ffc327fc65c2b95e8 (patch)
tree133bd2c62d8e56dd7ebf5f84659bcde56ba4b99b
parent8b75f8e691309ec68e5de1cbdf77f6e8b2b305f8 (diff)
downloadbugzilla-d133f849672bdd7ad1b22e2ffc327fc65c2b95e8.tar.gz
bugzilla-d133f849672bdd7ad1b22e2ffc327fc65c2b95e8.tar.xz
Bug 1479523 - Disable one-click component watching for logged out users
-rw-r--r--extensions/ComponentWatching/web/js/overlay.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/extensions/ComponentWatching/web/js/overlay.js b/extensions/ComponentWatching/web/js/overlay.js
index c0c540257..622749852 100644
--- a/extensions/ComponentWatching/web/js/overlay.js
+++ b/extensions/ComponentWatching/web/js/overlay.js
@@ -22,7 +22,12 @@ Bugzilla.ComponentWatching = class ComponentWatching {
constructor() {
this.buttons = document.querySelectorAll('button.component-watching');
- this.init();
+ // Check if the user is logged in and the API key is available. If not, remove the Watch buttons.
+ if (BUGZILLA.api_token) {
+ this.init();
+ } else {
+ this.buttons.forEach($button => $button.remove());
+ }
}
/**