Ignore the beta feature setting when enrolling in the A/B test

We realized that any change made to Special:Preferences will set the
beta preference even if they didn't visit the beta tab, so we can't
actually tell if manual intent was involved. As such, we'll enroll
people regardless of their beta setting -- they can disable the feature
through regular preferences if they want, and that'll be respected.

Bug: T291307
Change-Id: I8c1cbf51060012e8e68af252da84944dfcc681d8
This commit is contained in:
David Lynch 2021-12-17 11:30:09 -06:00
parent 2f1e2f80e0
commit 893290d4b4

View file

@ -99,19 +99,20 @@ class HookUtils {
}
}
// Being in the "test" group for this feature means it's enabled. This
// overrules the wiki's beta feature setting. (However, a user who's
// in the control group can still bypass this and enable the feature
// normally.)
$abtest = static::determineUserABTestBucket( $user, $feature );
if ( $abtest === 'test' ) {
return true;
}
// No feature-specific override found.
if ( $dtConfig->get( 'DiscussionToolsBeta' ) ) {
$betaenabled = $optionsLookup->getOption( $user, 'discussiontools-betaenable', -1 );
if ( $betaenabled !== -1 ) {
// betaenable doesn't have a default value, so we can check
// for it being unset like this. If the user has explicitly
// enabled or disabled it, we should immediately return that.
return (bool)$betaenabled;
}
// Otherwise, being in the "test" group for this feature means
// it's effectively beta-enabled.
return static::determineUserABTestBucket( $user, $feature ) === 'test';
$betaenabled = $optionsLookup->getOption( $user, 'discussiontools-betaenable', 0 );
return (bool)$betaenabled;
}
// Assume that if BetaFeature is turned off, or user has it enabled, that