]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1479523 - Disable one-click component watching for logged out users
authorKohei Yoshino <kohei.yoshino@gmail.com>
Tue, 31 Jul 2018 17:44:30 +0000 (13:44 -0400)
committerDylan William Hardison <dylan@hardison.net>
Tue, 31 Jul 2018 17:44:30 +0000 (13:44 -0400)
extensions/ComponentWatching/web/js/overlay.js

index c0c540257c1cb2d490b75373caa5e4d7775f22ec..6227498523437531aaf6bea19f269fd4000acce4 100644 (file)
@@ -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());
+    }
   }
 
   /**