Skip to content

Commit

Permalink
Existing privacy toggle no longer causes behaviour return; is removed:
Browse files Browse the repository at this point in the history
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 neurocracy/omnipedia#46
  • Loading branch information
Ambient-Impact committed Nov 9, 2023
1 parent ec3fed1 commit 2b3a3a7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions components/privacy_settings/privacy_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

}

/**
Expand Down

0 comments on commit 2b3a3a7

Please sign in to comment.