mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-23 22:13:34 +00:00
Merge "Remove unused preferences code for "alpha" visual editor opt-in"
This commit is contained in:
commit
3f43c00c2b
|
@ -321,7 +321,6 @@
|
|||
"visualeditor-preference-core-discussion-link": "//mediawiki.org/wiki/Special:MyLanguage/VisualEditor/Feedback",
|
||||
"visualeditor-preference-core-info-link": "//mediawiki.org/wiki/Special:MyLanguage/VisualEditor/Beta_Features/General",
|
||||
"visualeditor-preference-core-label": "Visual editing",
|
||||
"visualeditor-preference-enable": "Enable the visual editor. It will be available in the following {{PLURAL:$2|namespace|namespaces}}: $1",
|
||||
"visualeditor-preference-newwikitexteditor-description": "Enable the new wikitext mode inside the visual editor. It has many of the tools present in the visual editor, uses a similar design, and allows better switching between the two.",
|
||||
"visualeditor-preference-newwikitexteditor-discussion-link": "//mediawiki.org/wiki/2017_wikitext_editor/Feedback",
|
||||
"visualeditor-preference-newwikitexteditor-enable": "Use the wikitext mode inside the visual editor, instead of a different wikitext editor.",
|
||||
|
|
|
@ -338,11 +338,10 @@
|
|||
"visualeditor-mwpredialog-title": "Title for the preformatted text dialog. It appears when clicking on a <nowiki><pre></nowiki> element.",
|
||||
"visualeditor-mwsignature-tool": "Used as name of the tool for inserting signatures.",
|
||||
"visualeditor-preference-disable": "Label for the user preference to disable VisualEditor.",
|
||||
"visualeditor-preference-core-description": "Used in [[Special:Preferences]].\n\nUsed as description for the checkbox to enable the visual editor.\n\nThe label for this checkbox is {{msg-mw|Visualeditor-preference-core-label}}.\n\nSee also:\n* {{msg-mw|Visualeditor-preference-enable}}",
|
||||
"visualeditor-preference-core-description": "Used in [[Special:Preferences]].\n\nUsed as description for the checkbox to enable the visual editor.\n\nThe label for this checkbox is {{msg-mw|Visualeditor-preference-core-label}}.",
|
||||
"visualeditor-preference-core-discussion-link": "{{optional|Used on [[Special:Preferences]] as a link to a page where users can discuss this Beta Feature. Defaults to a page on MediaWiki.org.}}",
|
||||
"visualeditor-preference-core-info-link": "{{optional|Used on [[Special:Preferences]] as a link to a page where users can learn about this Beta Feature. Defaults to a page on MediaWiki.org.}}",
|
||||
"visualeditor-preference-core-label": "Used in [[Special:Preferences]].\n\nUsed as label for checkbox to enable the visual editor.\n\nThe description for this checkbox is: {{msg-mw|Visualeditor-preference-core-description}}",
|
||||
"visualeditor-preference-enable": "Label for the user preference to enable VisualEditor while it is in alpha (opt-in) mode.\n\nParameters:\n* $1 - Comma separated list of namespace names.\n* $2 - Number of namespaces in which it will be used.\n\nSee also:\n* {{msg-mw|Visualeditor-preference-core-description}}",
|
||||
"visualeditor-preference-newwikitexteditor-description": "Used in [[Special:Preferences]].\n\nUsed as description for the checkbox to enable the new wikitext editor.\n\nThe label for this checkbox is {{msg-mw|Visualeditor-preference-newwikitexteditor-label}}.",
|
||||
"visualeditor-preference-newwikitexteditor-discussion-link": "{{notranslate}}\nUsed on [[Special:Preferences]] as a link to a page where users can discuss this Beta Feature. Defaults to a page on MediaWiki.org.",
|
||||
"visualeditor-preference-newwikitexteditor-enable": "Label for the user preference to use the wikitext mode inside the visual editor. It replaces the wikitext editor software.",
|
||||
|
|
|
@ -787,23 +787,6 @@ class Hooks implements DifferenceEngineBeforeDiffTableHook {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a namespace index to the local text for display to the user.
|
||||
*
|
||||
* @param int $nsIndex
|
||||
* @return string
|
||||
*/
|
||||
private static function convertNs( $nsIndex ) {
|
||||
global $wgLang;
|
||||
if ( $nsIndex ) {
|
||||
return MediaWikiServices::getInstance()->getLanguageConverterFactory()
|
||||
->getLanguageConverter( $wgLang )
|
||||
->convertNamespace( $nsIndex );
|
||||
} else {
|
||||
return wfMessage( 'blanknamespace' )->text();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for the GetPreferences hook, to add and hide user preferences as configured
|
||||
*
|
||||
|
@ -811,38 +794,15 @@ class Hooks implements DifferenceEngineBeforeDiffTableHook {
|
|||
* @param array &$preferences Their preferences object
|
||||
*/
|
||||
public static function onGetPreferences( User $user, array &$preferences ) {
|
||||
global $wgLang;
|
||||
$services = MediaWikiServices::getInstance();
|
||||
$userOptionsLookup = $services->getUserOptionsLookup();
|
||||
$veConfig = $services->getConfigFactory()
|
||||
->makeConfig( 'visualeditor' );
|
||||
|
||||
if (
|
||||
$veConfig->get( 'VisualEditorEnableBetaFeature' ) &&
|
||||
!$veConfig->get( 'VisualEditorEnableBetaFeature' ) ||
|
||||
!ExtensionRegistry::getInstance()->isLoaded( 'BetaFeatures' )
|
||||
) {
|
||||
// Config option for visual editing "alpha" state (no Beta Feature)
|
||||
$namespaces = ApiVisualEditor::getAvailableNamespaceIds( $veConfig );
|
||||
|
||||
$visualEnablePreference = [
|
||||
'type' => 'toggle',
|
||||
'label-message' => [
|
||||
'visualeditor-preference-enable',
|
||||
$wgLang->commaList( array_map(
|
||||
[ self::class, 'convertNs' ],
|
||||
$namespaces
|
||||
) ),
|
||||
count( $namespaces )
|
||||
],
|
||||
'section' => 'editing/editor'
|
||||
];
|
||||
if ( $userOptionsLookup->getOption( $user, 'visualeditor-autodisable' ) ) {
|
||||
$visualEnablePreference['default'] = false;
|
||||
}
|
||||
$preferences['visualeditor-enable'] = $visualEnablePreference;
|
||||
}
|
||||
|
||||
if ( !$veConfig->get( 'VisualEditorEnableBetaFeature' ) ) {
|
||||
// Config option for visual editing "deployed" state (opt-out)
|
||||
$preferences['visualeditor-betatempdisable'] = [
|
||||
'type' => 'toggle',
|
||||
|
|
Loading…
Reference in a new issue