From 1d3dad574a38e97134cba0a3155650935f271df9 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sun, 27 Apr 2014 11:17:35 +0200 Subject: [PATCH] $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 --- includes/UserMailer.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 ); -- 2.20.1