Index: branches/RL2/extensions/Gadgets/SpecialGadgets.php |
— | — | @@ -204,6 +204,14 @@ |
205 | 205 | $repo = LocalGadgetRepo::singleton(); |
206 | 206 | $gadgetsByCategory = $repo->getGadgetsByCategory(); |
207 | 207 | |
| 208 | + // Only load the gadget manager module if needed |
| 209 | + if ( $user->isAllowed( 'gadgets-definition-delete' ) |
| 210 | + || $user->isAllowed( 'gadgets-definition-edit' ) |
| 211 | + || $user->isAllowed( 'gadgets-definition-create' ) |
| 212 | + ) { |
| 213 | + $out->addModules( 'ext.gadgets.gadgetmanager' ); |
| 214 | + } |
| 215 | + |
208 | 216 | // If there there are no gadgets at all, exit early. |
209 | 217 | if ( !count( $gadgetsByCategory ) ) { |
210 | 218 | $noGadgetsMsgHtml = Html::element( 'p', |
— | — | @@ -220,14 +228,6 @@ |
221 | 229 | Title::newFromText( 'Special:Recentchanges/namespace=' . NS_GADGET_DEFINITION )->getPrefixedText() |
222 | 230 | ); |
223 | 231 | |
224 | | - // Only load the gadget manager module if needed |
225 | | - if ( $user->isAllowed( 'gadgets-definition-delete' ) |
226 | | - || $user->isAllowed( 'gadgets-definition-edit' ) |
227 | | - || $user->isAllowed( 'gadgets-definition-create' ) |
228 | | - ) { |
229 | | - $out->addModules( 'ext.gadgets.gadgetmanager' ); |
230 | | - } |
231 | | - |
232 | 232 | // Sort categories alphabetically |
233 | 233 | ksort( $gadgetsByCategory ); |
234 | 234 | |