Reverted r111188: backport conflict fodder
[lhc/web/wiklou.git] / includes / UserMailer.php
index f4b9d59..14fd965 100644 (file)
@@ -109,8 +109,8 @@ class UserMailer {
        /**
         * Creates a single string from an associative array
         *
-        * @param $header Associative Array: keys are header field names,
-        *                values are ... values.
+        * @param $headers array Associative Array: keys are header field names,
+        *                 values are ... values.
         * @param $endl String: The end of line character.  Defaults to "\n"
         * @return String
         */
@@ -197,7 +197,7 @@ class UserMailer {
                $ret = wfRunHooks( 'AlternateUserMailer', array( $headers, $to, $from, $subject, $body ) );
                if ( $ret === false ) {
                        return Status::newGood();
-               } else if ( $ret !== true ) {
+               } elseif ( $ret !== true ) {
                        return Status::newFatal( 'php-mail-error', $ret );
                }
 
@@ -300,6 +300,7 @@ class UserMailer {
        /**
         * Converts a string into quoted-printable format
         * @since 1.17
+        * @return string
         */
        public static function quotedPrintable( $string, $charset = '' ) {
                # Probably incomplete; see RFC 2045
@@ -347,7 +348,7 @@ class UserMailer {
  *
  */
 class EmailNotification {
-       protected $to, $subject, $body, $replyto, $from;
+       protected $subject, $body, $replyto, $from;
        protected $timestamp, $summary, $minorEdit, $oldid, $composed_common;
        protected $mailTargets = array();
 
@@ -359,7 +360,7 @@ class EmailNotification {
        /**
         * @var User
         */
-       protected $user, $editor;
+       protected $editor;
 
        /**
         * Send emails corresponding to the user $editor editing the page $title.
@@ -512,6 +513,10 @@ class EmailNotification {
 
                global $wgUsersNotifiedOnAllChanges;
                foreach ( $wgUsersNotifiedOnAllChanges as $name ) {
+                       if ( $editor->getName() == $name ) {
+                               // No point notifying the user that actually made the change!
+                               continue;
+                       }
                        $user = User::newFromName( $name );
                        $this->compose( $user );
                }
@@ -550,7 +555,7 @@ class EmailNotification {
                                wfDebug( __METHOD__ . ": talk page owner doesn't want notifications\n" );
                        }
                }
-           return false;
+               return false;
        }
 
        /**
@@ -570,12 +575,13 @@ class EmailNotification {
                $keys = array();
 
                if ( $this->oldid ) {
-                       if ( $wgEnotifImpersonal ) {
-                               // For impersonal mail, show a diff link to the last revision.
-                               $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastdiff',
-                                       $this->title->getCanonicalUrl( 'diff=next&oldid=' . $this->oldid ) );
-                       } else {
-                               $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited',
+                       // Always show a link to the diff which triggered the mail. See bug 32210.
+                       $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastdiff',
+                               $this->title->getCanonicalUrl( 'diff=next&oldid=' . $this->oldid ) );
+                       if ( !$wgEnotifImpersonal ) {
+                               // For personal mail, also show a link to the diff of all changes
+                               // since last visited.
+                               $keys['$NEWPAGE'] .= " \n" . wfMsgForContent( 'enotif_lastvisited',
                                        $this->title->getCanonicalUrl( 'diff=0&oldid=' . $this->oldid ) );
                        }
                        $keys['$OLDID']   = $this->oldid;
@@ -701,6 +707,7 @@ class EmailNotification {
        /**
         * Same as sendPersonalised but does impersonal mail suitable for bulk
         * mailing.  Takes an array of MailAddress objects.
+        * @return Status
         */
        function sendImpersonal( $addresses ) {
                global $wgContLang;