Add feature flag to disable reference previews by default

This is a prerequisit for the later patch Ie0ccb03.

Any JavaScript code can check this feature flag via
mw.config.get( 'wgPopupsReferencePreviews' )

Bug: T213415
Change-Id: I17687c62cc8d738a4eb41738c9ce6662a5ec68d8
This commit is contained in:
Thiemo Kreuz 2019-01-21 11:24:33 +01:00
parent dcbbefe2fc
commit 485acf1488
4 changed files with 9 additions and 1 deletions

View file

@ -80,6 +80,7 @@ See the .storybook/README.md for details.
## Terminology ## Terminology
* Footnote - What the Cite extension shows at the bottom of the page.
* Hovercard - Deprecated term for popup. * Hovercard - Deprecated term for popup.
* Link preview - A similar user feature in the Android native app. * Link preview - A similar user feature in the Android native app.
* Navpop / nav pop - A popup-like UI from the NavigationPopups gadget. * Navpop / nav pop - A popup-like UI from the NavigationPopups gadget.
@ -87,3 +88,6 @@ See the .storybook/README.md for details.
being hovered over by a cursor. being hovered over by a cursor.
* Page preview - A specific type of popup that shows a page summary. * Page preview - A specific type of popup that shows a page summary.
* Preview - A synonym for popup. * Preview - A synonym for popup.
* Reference - A specific type of popup that previews the Cite extension's
footnotes. Since footnotes are typically used for references, and the tag's
name is `<ref>`, the terms are used synonymously.

View file

@ -72,6 +72,8 @@
"PopupsGateway": "mwApiPlain", "PopupsGateway": "mwApiPlain",
"@PopupsRestGatewayEndpoint": "Specify a REST endpoint where summaries should be sourced from. Endpoint must meet the spec at https://www.mediawiki.org/wiki/Specs/Summary/1.2.0", "@PopupsRestGatewayEndpoint": "Specify a REST endpoint where summaries should be sourced from. Endpoint must meet the spec at https://www.mediawiki.org/wiki/Specs/Summary/1.2.0",
"PopupsRestGatewayEndpoint": "/api/rest_v1/page/summary/", "PopupsRestGatewayEndpoint": "/api/rest_v1/page/summary/",
"@PopupsReferencePreviews": "Temporary feature flag to disable reference previews during developement.",
"PopupsReferencePreviews": false,
"@PopupsEventLogging": "Whether we should log events. Note if this is enabled without using that variable events will be logged for all users without any sampling! Be careful!", "@PopupsEventLogging": "Whether we should log events. Note if this is enabled without using that variable events will be logged for all users without any sampling! Be careful!",
"PopupsEventLogging": false, "PopupsEventLogging": false,
"@PopupsStatsvSamplingRate": "Sampling rate for logging performance data to statsv.", "@PopupsStatsvSamplingRate": "Sampling rate for logging performance data to statsv.",

View file

@ -112,6 +112,7 @@ class PopupsHooks {
$vars['wgPopupsGateway'] = $conf->get( 'PopupsGateway' ); $vars['wgPopupsGateway'] = $conf->get( 'PopupsGateway' );
$vars['wgPopupsEventLogging'] = $conf->get( 'PopupsEventLogging' ); $vars['wgPopupsEventLogging'] = $conf->get( 'PopupsEventLogging' );
$vars['wgPopupsRestGatewayEndpoint'] = $conf->get( 'PopupsRestGatewayEndpoint' ); $vars['wgPopupsRestGatewayEndpoint'] = $conf->get( 'PopupsRestGatewayEndpoint' );
$vars['wgPopupsReferencePreviews'] = $conf->get( 'PopupsReferencePreviews' );
$vars['wgPopupsStatsvSamplingRate'] = $conf->get( 'PopupsStatsvSamplingRate' ); $vars['wgPopupsStatsvSamplingRate'] = $conf->get( 'PopupsStatsvSamplingRate' );
} }

View file

@ -171,11 +171,12 @@ class PopupsHooksTest extends MediaWikiTestCase {
'wgPopupsRestGatewayEndpoint' => '/api', 'wgPopupsRestGatewayEndpoint' => '/api',
'wgPopupsVirtualPageViews' => true, 'wgPopupsVirtualPageViews' => true,
'wgPopupsGateway' => 'mwApiPlain', 'wgPopupsGateway' => 'mwApiPlain',
'wgPopupsReferencePreviews' => false,
'wgPopupsStatsvSamplingRate' => 0 'wgPopupsStatsvSamplingRate' => 0
]; ];
$this->setMwGlobals( $config ); $this->setMwGlobals( $config );
PopupsHooks::onResourceLoaderGetConfigVars( $vars ); PopupsHooks::onResourceLoaderGetConfigVars( $vars );
$this->assertCount( 6, $vars, 'A configuration is retrieved.' ); $this->assertCount( 7, $vars, 'A configuration is retrieved.' );
foreach ( $config as $key => $value ) { foreach ( $config as $key => $value ) {
$this->assertEquals( $this->assertEquals(