From: Kohei Yoshino Date: Tue, 31 Jul 2018 17:44:30 +0000 (-0400) Subject: Bug 1479523 - Disable one-click component watching for logged out users X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d133f849672bdd7ad1b22e2ffc327fc65c2b95e8;p=thirdparty%2Fbugzilla.git Bug 1479523 - Disable one-click component watching for logged out users --- 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()); + } } /**