Don't export unused wgEchoOverlayConfiguration/wgEchoHelpPage JS variables

And make the if conditional a little easier to read: is logged in versus
not anonymous.

Change-Id: I76784b74caabd1ea0a5f0f506661a1682c865394
This commit is contained in:
Kunal Mehta 2015-11-12 10:38:04 -08:00
parent b46fcf57b3
commit 0790125dd4

View file

@ -812,17 +812,12 @@ class EchoHooks {
* @return bool true in all cases
*/
public static function makeGlobalVariablesScript( &$vars, OutputPage $outputPage ) {
global $wgEchoHelpPage, $wgEchoMaxNotificationCount, $wgEchoConfig;
global $wgEchoConfig;
$user = $outputPage->getUser();
// Provide info for the Overlay
if ( !$user->isAnon() ) {
$vars['wgEchoOverlayConfiguration'] = array(
'notification-count' => MWEchoNotifUser::newFromUser( $user )->getFormattedNotificationCount(),
'max-notification-count' => $wgEchoMaxNotificationCount,
);
$vars['wgEchoHelpPage'] = $wgEchoHelpPage;
if ( $user->isLoggedIn() ) {
$vars['wgEchoConfig'] = $wgEchoConfig;
} elseif (
$outputPage->getTitle()->equals( SpecialPage::getTitleFor( 'JavaScriptTest', 'qunit' ) ) ||