Don't shown red box around unconfirmed email address in preferences if authentication...
authorAlex Monk <krenair@gmail.com>
Fri, 10 May 2013 21:05:22 +0000 (22:05 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 11 May 2013 13:53:54 +0000 (13:53 +0000)
Susan and Base-w in #wikimedia discovered that a red box is always shown around
their email address on foundationwiki. This is because the box is shown by
default - even when email address authentication is disabled.

Change-Id: I0b906b23dec6018bc21a179e2cf950b705100c4c

includes/Preferences.php

index 0d765fa..972e2c6 100644 (file)
@@ -409,8 +409,8 @@ class Preferences {
 
                        $disableEmailPrefs = false;
 
-                       $emailauthenticationclass = 'mw-email-not-authenticated';
                        if ( $wgEmailAuthentication ) {
+                               $emailauthenticationclass = 'mw-email-not-authenticated';
                                if ( $user->getEmail() ) {
                                        if ( $user->getEmailAuthenticationTimestamp() ) {
                                                // date and time are separate parameters to facilitate localisation.
@@ -449,8 +449,8 @@ class Preferences {
                                        # Apply the same CSS class used on the input to the message:
                                        'cssclass' => $emailauthenticationclass,
                                );
+                               $defaultPreferences['emailaddress']['cssclass'] = $emailauthenticationclass;
                        }
-                       $defaultPreferences['emailaddress']['cssclass'] = $emailauthenticationclass;
 
                        if ( $wgEnableUserEmail && $user->isAllowed( 'sendemail' ) ) {
                                $defaultPreferences['disablemail'] = array(