mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 17:00:37 +00:00
Adds "$wgPopupsTextExtractsIntroOnly" option to control "intro" parameters for TextExtracts API request
Change-Id: I84f91ab0752bbd4a5b1ee159b7cbe1388f942f24
This commit is contained in:
parent
d1d0b2a704
commit
ff2ba9ebf5
|
@ -113,6 +113,10 @@
|
|||
"Special:MostLinkedFiles",
|
||||
"Special:Book"
|
||||
]
|
||||
},
|
||||
"PopupsTextExtractsIntroOnly": {
|
||||
"description": "Whether we should extract intro text only or full page text. This is only applicable when using PopupsGateway=mwApiPlain.",
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"ResourceModules": {
|
||||
|
|
|
@ -134,6 +134,7 @@ class PopupsHooks {
|
|||
$vars['wgPopupsEventLogging'] = $config->get( 'PopupsEventLogging' );
|
||||
$vars['wgPopupsRestGatewayEndpoint'] = $config->get( 'PopupsRestGatewayEndpoint' );
|
||||
$vars['wgPopupsStatsvSamplingRate'] = $config->get( 'PopupsStatsvSamplingRate' );
|
||||
$vars['wgPopupsTextExtractsIntroOnly'] = $config->get( 'PopupsTextExtractsIntroOnly' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
"bundlesize": [
|
||||
{
|
||||
"path": "resources/dist/index.js",
|
||||
"maxSize": "13.6kB"
|
||||
"maxSize": "13.61kB"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.map.json
vendored
BIN
resources/dist/index.js.map.json
vendored
Binary file not shown.
|
@ -37,7 +37,7 @@ export default function createMediaWikiApiGateway( api, config ) {
|
|||
prop: 'info|extracts|pageimages|revisions|info',
|
||||
formatversion: 2,
|
||||
redirects: true,
|
||||
exintro: true,
|
||||
exintro: mw.config.get( 'wgPopupsTextExtractsIntroOnly', true ),
|
||||
exchars: config.EXTRACT_LENGTH,
|
||||
|
||||
// There is an added geometric limit on .mwe-popups-extract
|
||||
|
|
|
@ -153,11 +153,12 @@ class PopupsHooksTest extends MediaWikiTestCase {
|
|||
'wgPopupsRestGatewayEndpoint' => '/api',
|
||||
'wgPopupsVirtualPageViews' => true,
|
||||
'wgPopupsGateway' => 'mwApiPlain',
|
||||
'wgPopupsStatsvSamplingRate' => 0
|
||||
'wgPopupsStatsvSamplingRate' => 0,
|
||||
'wgPopupsTextExtractsIntroOnly' => true,
|
||||
];
|
||||
$this->setMwGlobals( $config );
|
||||
PopupsHooks::onResourceLoaderGetConfigVars( $vars, '' );
|
||||
$this->assertCount( 6, $vars, 'A configuration is retrieved.' );
|
||||
$this->assertCount( 7, $vars, 'A configuration is retrieved.' );
|
||||
|
||||
foreach ( $config as $key => $value ) {
|
||||
$this->assertSame(
|
||||
|
|
Loading…
Reference in a new issue