From: umherirrender Date: Sun, 27 Apr 2014 09:17:35 +0000 (+0200) Subject: $wgEnotifUseRealName: Check, if realname is non-empty X-Git-Tag: 1.31.0-rc.0~15791^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=1d3dad574a38e97134cba0a3155650935f271df9;p=lhc%2Fweb%2Fwiklou.git $wgEnotifUseRealName: Check, if realname is non-empty When $wgEnotifUseRealName is true and no realname is given, the email notification will contain a empty string, so checking the realname first Change-Id: I1b76d9eae8ada8ca2eee8fa93d7119fbff44269d --- diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 1ec2792900..2885e6a500 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -58,7 +58,7 @@ class MailAddress { if ( $this->address ) { if ( $this->name != '' && !wfIsWindows() ) { global $wgEnotifUseRealName; - $name = ( $wgEnotifUseRealName && $this->realName ) ? $this->realName : $this->name; + $name = ( $wgEnotifUseRealName && $this->realName !== '' ) ? $this->realName : $this->name; $quoted = UserMailer::quotedPrintable( $name ); if ( strpos( $quoted, '.' ) !== false || strpos( $quoted, ',' ) !== false ) { $quoted = '"' . $quoted . '"'; @@ -761,7 +761,8 @@ class EmailNotification { $keys['$PAGEEDITOR_EMAIL'] = wfMessage( 'noemailtitle' )->inContentLanguage()->text(); } else { - $keys['$PAGEEDITOR'] = $wgEnotifUseRealName ? $this->editor->getRealName() : $this->editor->getName(); + $keys['$PAGEEDITOR'] = $wgEnotifUseRealName && $this->editor->getRealName() !== '' + ? $this->editor->getRealName() : $this->editor->getName(); $emailPage = SpecialPage::getSafeTitleFor( 'Emailuser', $this->editor->getName() ); $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalURL(); } @@ -868,7 +869,8 @@ class EmailNotification { array( '$WATCHINGUSERNAME', '$PAGEEDITDATE', '$PAGEEDITTIME' ), - array( $wgEnotifUseRealName ? $watchingUser->getRealName() : $watchingUser->getName(), + array( $wgEnotifUseRealName && $watchingUser->getRealName() !== '' + ? $watchingUser->getRealName() : $watchingUser->getName(), $wgContLang->userDate( $this->timestamp, $watchingUser ), $wgContLang->userTime( $this->timestamp, $watchingUser ) ), $this->body );