Follow-up I3f03dd0100 (08adf46): simplify checks
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Thu, 25 Jul 2013 09:52:29 +0000 (11:52 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Thu, 25 Jul 2013 15:51:41 +0000 (17:51 +0200)
Those variables are only used when $canViewPrivateInfo is true;
so no need set them when it is not the case

Change-Id: I87a27ea94f3eadc757b6e6048437a7ec58d09d03

includes/Preferences.php

index 16a7a6c..6f4f327 100644 (file)
@@ -397,30 +397,30 @@ class Preferences {
                ## Email stuff
 
                if ( $wgEnableEmail ) {
-                       $helpMessages[] = $wgEmailConfirmToEdit
-                                       ? 'prefs-help-email-required'
-                                       : 'prefs-help-email';
-
-                       if ( $wgEnableUserEmail ) {
-                               // additional messages when users can send email to each other
-                               $helpMessages[] = 'prefs-help-email-others';
-                       }
+                       if ( $canViewPrivateInfo ) {
+                               $helpMessages[] = $wgEmailConfirmToEdit
+                                               ? 'prefs-help-email-required'
+                                               : 'prefs-help-email';
 
-                       $link = Linker::link(
-                               SpecialPage::getTitleFor( 'ChangeEmail' ),
-                               $context->msg( $user->getEmail() ? 'prefs-changeemail' : 'prefs-setemail' )->escaped(),
-                               array(),
-                               array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ) );
+                               if ( $wgEnableUserEmail ) {
+                                       // additional messages when users can send email to each other
+                                       $helpMessages[] = 'prefs-help-email-others';
+                               }
 
-                       $emailAddress = $user->getEmail() ? htmlspecialchars( $user->getEmail() ) : '';
-                       if ( $canEditPrivateInfo && $wgAuth->allowPropChange( 'emailaddress' ) ) {
-                               $emailAddress .= $emailAddress == '' ? $link : (
-                                       $context->msg( 'word-separator' )->plain()
-                                       . $context->msg( 'parentheses' )->rawParams( $link )->plain()
-                               );
-                       }
+                               $emailAddress = $user->getEmail() ? htmlspecialchars( $user->getEmail() ) : '';
+                               if ( $canEditPrivateInfo && $wgAuth->allowPropChange( 'emailaddress' ) ) {
+                                       $link = Linker::link(
+                                               SpecialPage::getTitleFor( 'ChangeEmail' ),
+                                               $context->msg( $user->getEmail() ? 'prefs-changeemail' : 'prefs-setemail' )->escaped(),
+                                               array(),
+                                               array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ) );
+
+                                       $emailAddress .= $emailAddress == '' ? $link : (
+                                               $context->msg( 'word-separator' )->plain()
+                                               . $context->msg( 'parentheses' )->rawParams( $link )->plain()
+                                       );
+                               }
 
-                       if ( $canViewPrivateInfo ) {
                                $defaultPreferences['emailaddress'] = array(
                                        'type' => 'info',
                                        'raw' => true,