mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 15:16:50 +00:00
Fix confusing constant names in PHP
The …AFTER_BETA constant is the one we want to keep after we removed all BetaFeature code. The naming scheme is just confusing. Safe to rename. Not used anywhere else: https://codesearch.wmcloud.org/search/?q=REFERENCE_PREVIEWS_PREFERENCE_NAME We also decided to keep the $wgPopupsReferencePreviews feature flag. Update the documentation accordingly. This is split from I1556b2f to make it easier to review. Bug: T351708 Change-Id: Ifbb41156f2a5a4d8a81e79f613754869c5c89690
This commit is contained in:
parent
0018e71804
commit
7596165a5d
|
@ -83,7 +83,7 @@
|
|||
"value": "/api/rest_v1/page/summary/"
|
||||
},
|
||||
"PopupsReferencePreviews": {
|
||||
"description": "Temporary feature flag to disable reference previews during developement.",
|
||||
"description": "Feature flag to enable or disable the separate popup type for references created via the Cite extension's <ref> tag.",
|
||||
"value": true
|
||||
},
|
||||
"PopupsReferencePreviewsBetaFeature": {
|
||||
|
|
|
@ -61,12 +61,12 @@ class PopupsContext {
|
|||
* User preference key to enable/disable Reference Previews. Named
|
||||
* "mwe-popups-referencePreviews-enabled" in localStorage for anonymous users.
|
||||
*/
|
||||
public const REFERENCE_PREVIEWS_PREFERENCE_NAME_AFTER_BETA = 'popups-reference-previews';
|
||||
public const REFERENCE_PREVIEWS_PREFERENCE_NAME = 'popups-reference-previews';
|
||||
|
||||
/**
|
||||
* User preference key to enable/disable Reference Previews
|
||||
*/
|
||||
public const REFERENCE_PREVIEWS_PREFERENCE_NAME = 'popupsreferencepreviews';
|
||||
public const REFERENCE_PREVIEWS_BETA_PREFERENCE_NAME = 'popupsreferencepreviews';
|
||||
|
||||
/**
|
||||
* Flags passed on to JS representing preferences
|
||||
|
@ -159,7 +159,6 @@ class PopupsContext {
|
|||
* @return bool whether or not to show reference previews
|
||||
*/
|
||||
public function isReferencePreviewsEnabled( \User $user ) {
|
||||
// TODO: Remove when the feature flag is not needed any more
|
||||
if ( !$this->config->get( 'PopupsReferencePreviews' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -168,12 +167,12 @@ class PopupsContext {
|
|||
if ( $this->isReferencePreviewsInBeta() ) {
|
||||
return BetaFeatures::isFeatureEnabled(
|
||||
$user,
|
||||
self::REFERENCE_PREVIEWS_PREFERENCE_NAME
|
||||
self::REFERENCE_PREVIEWS_BETA_PREFERENCE_NAME
|
||||
);
|
||||
}
|
||||
|
||||
return !$user->isNamed() || $this->userOptionsLookup->getBoolOption(
|
||||
$user, self::REFERENCE_PREVIEWS_PREFERENCE_NAME_AFTER_BETA
|
||||
$user, self::REFERENCE_PREVIEWS_PREFERENCE_NAME
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ class PopupsHooks implements
|
|||
}
|
||||
|
||||
return [
|
||||
PopupsContext::REFERENCE_PREVIEWS_PREFERENCE_NAME_AFTER_BETA => $option
|
||||
PopupsContext::REFERENCE_PREVIEWS_PREFERENCE_NAME => $option
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ class PopupsHooks implements
|
|||
if ( $config->get( 'PopupsReferencePreviews' ) &&
|
||||
!$config->get( 'PopupsReferencePreviewsBetaFeature' )
|
||||
) {
|
||||
$defaultOptions[PopupsContext::REFERENCE_PREVIEWS_PREFERENCE_NAME_AFTER_BETA] = '1';
|
||||
$defaultOptions[PopupsContext::REFERENCE_PREVIEWS_PREFERENCE_NAME] = '1';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ class PopupsHooks implements
|
|||
) {
|
||||
$this->userOptionsManager->setOption(
|
||||
$user,
|
||||
PopupsContext::REFERENCE_PREVIEWS_PREFERENCE_NAME_AFTER_BETA,
|
||||
PopupsContext::REFERENCE_PREVIEWS_PREFERENCE_NAME,
|
||||
$default
|
||||
);
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ class PopupsHooks implements
|
|||
if ( $config->get( 'PopupsReferencePreviewsBetaFeature' ) &&
|
||||
$config->get( 'PopupsReferencePreviews' )
|
||||
) {
|
||||
$prefs[PopupsContext::REFERENCE_PREVIEWS_PREFERENCE_NAME] = [
|
||||
$prefs[PopupsContext::REFERENCE_PREVIEWS_BETA_PREFERENCE_NAME] = [
|
||||
'label-message' => 'popups-refpreview-beta-feature-message',
|
||||
'desc-message' => 'popups-refpreview-beta-feature-description',
|
||||
'screenshot' => [
|
||||
|
|
|
@ -304,7 +304,7 @@ class PopupsHooksTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertCount( 3 - $beta, $userOptions );
|
||||
$this->assertSame( '1', $userOptions[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME ] );
|
||||
if ( $beta === false ) {
|
||||
$this->assertSame( '1', $userOptions[ PopupsContext::REFERENCE_PREVIEWS_PREFERENCE_NAME_AFTER_BETA ] );
|
||||
$this->assertSame( '1', $userOptions[ PopupsContext::REFERENCE_PREVIEWS_PREFERENCE_NAME ] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue