mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
Filter JavaScript namespacesWithSubpages to only existing namespaces
$wgNamespacesWithSubpages can include namespaces that don't exist, no need to add them to the JavaScript configuration. Bug: T291727 Change-Id: I1f4f3d2c2accb3d84f83262480616d05115f406c
This commit is contained in:
parent
492fcfbd9f
commit
267daeb6c6
|
@ -1007,6 +1007,16 @@ class VisualEditorHooks {
|
|||
)
|
||||
);
|
||||
|
||||
$namespacesWithSubpages = $coreConfig->get( 'NamespacesWithSubpages' );
|
||||
// $namespacesWithSubpages is a map of namespace id to boolean value, we want
|
||||
// to filter out namespaces that don't exist, not need to include those and it
|
||||
// would increase the JavaScript config size. See T291727
|
||||
$nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
|
||||
$namespacesWithSubpages = array_filter(
|
||||
$namespacesWithSubpages,
|
||||
[ $nsInfo, 'exists' ],
|
||||
ARRAY_FILTER_USE_KEY
|
||||
);
|
||||
$vars['wgVisualEditorConfig'] = [
|
||||
'usePageImages' => $extensionRegistry->isLoaded( 'PageImages' ),
|
||||
'usePageDescriptions' => $extensionRegistry->isLoaded( 'WikibaseClient' ),
|
||||
|
@ -1036,7 +1046,7 @@ class VisualEditorHooks {
|
|||
$veConfig->get( 'VisualEditorEnableWikitextBetaFeature' )
|
||||
),
|
||||
'useChangeTagging' => $veConfig->get( 'VisualEditorUseChangeTagging' ),
|
||||
'namespacesWithSubpages' => $coreConfig->get( 'NamespacesWithSubpages' ),
|
||||
'namespacesWithSubpages' => $namespacesWithSubpages,
|
||||
'specialBooksources' => urldecode( SpecialPage::getTitleFor( 'Booksources' )->getPrefixedURL() ),
|
||||
'rebaserUrl' => $coreConfig->get( 'VisualEditorRebaserURL' ),
|
||||
'restbaseUrl' => $coreConfig->get( 'VisualEditorRestbaseURL' ),
|
||||
|
|
Loading…
Reference in a new issue