From d133f849672bdd7ad1b22e2ffc327fc65c2b95e8 Mon Sep 17 00:00:00 2001 From: Kohei Yoshino Date: Tue, 31 Jul 2018 13:44:30 -0400 Subject: Bug 1479523 - Disable one-click component watching for logged out users --- extensions/ComponentWatching/web/js/overlay.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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()); + } } /** -- cgit v1.2.3-24-g4f1b