* @param User $editor The editor that triggered the update. Their notification
* timestamp will not be updated(they have already seen it)
* @param Title $title The title to update timestamps for
- * @param string $timestamp Set the upate timestamp to this value
+ * @param string $timestamp Set the update timestamp to this value
* @return int[]
*/
public static function updateWatchlistTimestamp( User $editor, Title $title, $timestamp ) {
/**
* Send emails corresponding to the user $editor editing the page $title.
- * Also updates wl_notificationtimestamp.
*
* May be deferred via the job queue.
*
$sendEmail = true;
// If nobody is watching the page, and there are no users notified on all changes
- // don't bother creating a job/trying to send emails
+ // don't bother creating a job/trying to send emails, unless it's a
+ // talk page with an applicable notification.
+ //
// $watchers deals with $wgEnotifWatchlist
if ( !count( $watchers ) && !count( $wgUsersNotifiedOnAllChanges ) ) {
$sendEmail = false;
* Immediate version of notifyOnPageChange().
*
* Send emails corresponding to the user $editor editing the page $title.
- * Also updates wl_notificationtimestamp.
*
+ * @note Do not call directly. Use notifyOnPageChange so that wl_notificationtimestamp is updated.
* @param User $editor
* @param Title $title
* @param string $timestamp Edit timestamp
public function actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit,
$oldid, $watchers, $pageStatus = 'changed' ) {
# we use $wgPasswordSender as sender's address
- global $wgEnotifWatchlist;
+ global $wgEnotifWatchlist, $wgBlockDisablesLogin;
global $wgEnotifMinorEdits, $wgEnotifUserTalk;
# The following code is only run, if several conditions are met:
if ( $wgEnotifWatchlist ) {
// Send updates to watchers other than the current editor
+ // and don't send to watchers who are blocked and cannot login
$userArray = UserArray::newFromIDs( $watchers );
foreach ( $userArray as $watchingUser ) {
if ( $watchingUser->getOption( 'enotifwatchlistpages' )
&& ( !$minorEdit || $watchingUser->getOption( 'enotifminoredits' ) )
&& $watchingUser->isEmailConfirmed()
&& $watchingUser->getID() != $userTalkId
+ && !( $wgBlockDisablesLogin && $watchingUser->isBlocked() )
) {
if ( Hooks::run( 'SendWatchlistEmailNotification', array( $watchingUser, $title, $this ) ) ) {
$this->compose( $watchingUser );
* @return bool
*/
private function canSendUserTalkEmail( $editor, $title, $minorEdit ) {
- global $wgEnotifUserTalk;
+ global $wgEnotifUserTalk, $wgBlockDisablesLogin;
$isUserTalkPage = ( $title->getNamespace() == NS_USER_TALK );
if ( $wgEnotifUserTalk && $isUserTalkPage ) {
wfDebug( __METHOD__ . ": user talk page edited, but user does not exist\n" );
} elseif ( $targetUser->getId() == $editor->getId() ) {
wfDebug( __METHOD__ . ": user edited their own talk page, no notification sent\n" );
+ } elseif ( $wgBlockDisablesLogin && $targetUser->isBlocked() ) {
+ wfDebug( __METHOD__ . ": talk page owner is blocked and cannot login, no notification sent\n" );
} elseif ( $targetUser->getOption( 'enotifusertalkpages' )
&& ( !$minorEdit || $targetUser->getOption( 'enotifminoredits' ) )
) {
$wgContLang->userTime( $this->timestamp, $watchingUser ) ),
$this->body );
- return UserMailer::send( $to, $this->from, $this->subject, $body, $this->replyto );
+ return UserMailer::send( $to, $this->from, $this->subject, $body, array(
+ 'replyTo' => $this->replyto,
+ ) );
}
/**
$wgContLang->time( $this->timestamp, false, false ) ),
$this->body );
- return UserMailer::send( $addresses, $this->from, $this->subject, $body, $this->replyto );
+ return UserMailer::send( $addresses, $this->from, $this->subject, $body, array(
+ 'replyTo' => $this->replyto,
+ ) );
}
}