Avoid adding hidden gadgets in default options

Hidden gadgets do not have associated user preferences. Adding them to $defaultOptions only causes them to be unnecessarily exported in mw.user.options.

Bug: T299071
Change-Id: Ic55e7f2a9daa405cddd0189de3d32f5825bc336a
This commit is contained in:
Siddharth VP 2022-01-12 22:49:58 +05:30
parent 2d1f320e23
commit 43efda4f96

View file

@ -73,7 +73,10 @@ class GadgetHooks {
*/
foreach ( $gadgets as $thisSection ) {
foreach ( $thisSection as $gadgetId => $gadget ) {
$defaultOptions['gadget-' . $gadgetId] = $gadget->isOnByDefault() ? 1 : 0;
// Hidden gadgets don't need to be added here, T299071
if ( !$gadget->isHidden() ) {
$defaultOptions['gadget-' . $gadgetId] = $gadget->isOnByDefault() ? 1 : 0;
}
}
}
}