From 2b3a3a7e386c733b1a7d122078ac1448dfff19c0 Mon Sep 17 00:00:00 2001 From: Matei Stanca Date: Thu, 9 Nov 2023 17:37:02 -0500 Subject: [PATCH] Existing privacy toggle no longer causes behaviour return; is removed: We also log a warning to the console so that this kind of state error doesn't get swept under the rug and is easier to find. See https://github.com/neurocracy/omnipedia/issues/46 --- components/privacy_settings/privacy_settings.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/privacy_settings/privacy_settings.js b/components/privacy_settings/privacy_settings.js index 36bcf8a..6f1d86e 100644 --- a/components/privacy_settings/privacy_settings.js +++ b/components/privacy_settings/privacy_settings.js @@ -36,10 +36,16 @@ AmbientImpact.addComponent('OmnipediaPrivacySettings', function( '.block-omnipedia-privacy-settings', function(context, settings) { - // Bail if we've already built the toggle so that we don't end up with + // Remove any existing toggle if it exists so that we don't end up with // duplicate elements. if ($toggle.length > 0) { - return; + + console.warn( + 'Found existing privacy toggle while attaching behaviour:', $toggle + ); + + $toggle.remove(); + } /**