Merge "Store the Title and User objects passed RecentChange::notify*()"
authorSiebrand <siebrand@wikimedia.org>
Sun, 29 Jul 2012 20:43:36 +0000 (20:43 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 29 Jul 2012 20:43:36 +0000 (20:43 +0000)
1  2 
includes/RecentChange.php

@@@ -218,28 -239,17 +239,19 @@@ class RecentChange 
                }
  
                # E-mail notifications
-               global $wgUseEnotif, $wgShowUpdatedMarker, $wgUser;
                if( $wgUseEnotif || $wgShowUpdatedMarker ) {
-                       // Users
-                       if( $this->mAttribs['rc_user'] ) {
-                               $editor = ($wgUser->getId() == $this->mAttribs['rc_user']) ?
-                                       $wgUser : User::newFromID( $this->mAttribs['rc_user'] );
-                       // Anons
-                       } else {
-                               $editor = ($wgUser->getName() == $this->mAttribs['rc_user_text']) ?
-                                       $wgUser : User::newFromName( $this->mAttribs['rc_user_text'], false );
-                       }
-                       $title = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
+                       $editor = $this->getPerformer();
+                       $title = $this->getTitle();
  
 -                      # @todo FIXME: This would be better as an extension hook
 -                      $enotif = new EmailNotification();
 -                      $status = $enotif->notifyOnPageChange( $editor, $title,
 -                              $this->mAttribs['rc_timestamp'],
 -                              $this->mAttribs['rc_comment'],
 -                              $this->mAttribs['rc_minor'],
 -                              $this->mAttribs['rc_last_oldid'] );
 +                      if ( wfRunHooks( 'AbortEmailNotification', array($editor, $title) ) ) {
 +                              # @todo FIXME: This would be better as an extension hook
 +                              $enotif = new EmailNotification();
 +                              $status = $enotif->notifyOnPageChange( $editor, $title,
 +                                      $this->mAttribs['rc_timestamp'],
 +                                      $this->mAttribs['rc_comment'],
 +                                      $this->mAttribs['rc_minor'],
 +                                      $this->mAttribs['rc_last_oldid'] );
 +                      }
                }
        }