Restore persistent sidebar

Bug: T305989
Change-Id: I1304c777ad9581cd8b9153ad1e4483e31660857e
This commit is contained in:
Jon Robson 2022-04-14 11:21:12 -07:00 committed by Jdlrobson
parent 79cde24aff
commit f38a2afbf6
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",