Merge "Restore persistent sidebar"

This commit is contained in:
jenkins-bot 2022-04-18 21:47:34 +00:00 committed by Gerrit Code Review
commit 7565486e09
2 changed files with 20 additions and 0 deletions

View File

@ -447,6 +447,25 @@ class Hooks {
}
}
/**
* Adds the persistent sidebar hidden API preference.
*
* @param User $user User whose preferences are being modified.
* @param array[] &$prefs Preferences description array, to be fed to a HTMLForm object.
*/
public static function onGetPreferences( User $user, array &$prefs ) {
$config = MediaWikiServices::getInstance()->getMainConfig();
$vectorPrefs = [
Constants::PREF_KEY_SIDEBAR_VISIBLE => [
'type' => 'api',
'default' => $config->get(
Constants::CONFIG_KEY_DEFAULT_SIDEBAR_VISIBLE_FOR_AUTHORISED_USER
),
],
];
$prefs += $vectorPrefs;
}
/**
* Called one time when initializing a users preferences for a newly created account.
*

View File

@ -129,6 +129,7 @@
"Vector\\": "includes/"
},
"Hooks": {
"GetPreferences": "Vector\\Hooks::onGetPreferences",
"ResourceLoaderSiteModulePages": "Vector\\Hooks::onResourceLoaderSiteModulePages",
"ResourceLoaderSiteStylesModulePages": "Vector\\Hooks::onResourceLoaderSiteStylesModulePages",
"SkinPageReadyConfig": "Vector\\Hooks::onSkinPageReadyConfig",