jenkins-bot has submitted this change and it was merged.
Change subject: isFeatureEnabled: Return false if the feature is not whitelisted
......................................................................
isFeatureEnabled: Return false if the feature is not whitelisted
If a feature was enabled at some point and is later disabled via
not being included in the whitelist, the user preference will still
be set, so the code checking for isFeatureEnabled will return true,
even though it shouldn't be.
Change-Id: I7f02f4926f9b8fc666f0cde500535052a5548040
---
M includes/BetaFeaturesUtil.php
1 file changed, 6 insertions(+), 0 deletions(-)
Approvals:
Jforrester: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/BetaFeaturesUtil.php b/includes/BetaFeaturesUtil.php
index 731ed56..7119b01 100644
--- a/includes/BetaFeaturesUtil.php
+++ b/includes/BetaFeaturesUtil.php
@@ -33,6 +33,12 @@
* @return bool
*/
static function isFeatureEnabled( $user, $feature ) {
+ global $wgBetaFeaturesWhitelist;
+ if ( is_array( $wgBetaFeaturesWhitelist ) && !in_array(
$feature, $wgBetaFeaturesWhitelist ) ) {
+ // If there is a whitelist, and the feature is not
whitelisted,
+ // it can't be enabled.
+ return false;
+ }
return $user->getOption( $feature ) ===
HTMLFeatureField::OPTION_ENABLED;
}
}
--
To view, visit https://gerrit.wikimedia.org/r/125946
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7f02f4926f9b8fc666f0cde500535052a5548040
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BetaFeatures
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits