X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmail%2FEmailNotification.php;h=0b77651bdace4a881aea6924a6404185d781cc2c;hb=e86a060284e8ade65ca1e358b0b449fd0c0d9559;hp=8a089f69307dca4b72035145db22df66ded73efa;hpb=9b98959aedcafe01906a259cf926fa88d203a166;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/mail/EmailNotification.php b/includes/mail/EmailNotification.php index 8a089f6930..0b77651bda 100644 --- a/includes/mail/EmailNotification.php +++ b/includes/mail/EmailNotification.php @@ -24,7 +24,6 @@ * @author Luke Welling lwelling@wikimedia.org */ -use MediaWiki\Linker\LinkTarget; use MediaWiki\MediaWikiServices; /** @@ -89,33 +88,6 @@ class EmailNotification { return $this->pageStatus; } - /** - * @deprecated since 1.27 use WatchedItemStore::updateNotificationTimestamp directly - * - * @param User $editor The editor that triggered the update. Their notification - * timestamp will not be updated(they have already seen it) - * @param LinkTarget $linkTarget The link target of the title to update timestamps for - * @param string $timestamp Set the update timestamp to this value - * - * @return int[] Array of user IDs - */ - public static function updateWatchlistTimestamp( - User $editor, - LinkTarget $linkTarget, - $timestamp - ) { - wfDeprecated( __METHOD__, '1.27' ); - $config = RequestContext::getMain()->getConfig(); - if ( !$config->get( 'EnotifWatchlist' ) && !$config->get( 'ShowUpdatedMarker' ) ) { - return []; - } - return MediaWikiServices::getInstance()->getWatchedItemStore()->updateNotificationTimestamp( - $editor, - $linkTarget, - $timestamp - ); - } - /** * Send emails corresponding to the user $editor editing the page $title. * @@ -154,7 +126,7 @@ class EmailNotification { // 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, unless it's a // talk page with an applicable notification. - if ( !count( $watchers ) && !count( $wgUsersNotifiedOnAllChanges ) ) { + if ( $watchers === [] && !count( $wgUsersNotifiedOnAllChanges ) ) { $sendEmail = false; // Only send notification for non minor edits, unless $wgEnotifMinorEdits if ( !$minorEdit || ( $wgEnotifMinorEdits && !$editor->isAllowed( 'nominornewtalk' ) ) ) { @@ -252,11 +224,12 @@ class EmailNotification { && $watchingUser->isEmailConfirmed() && $watchingUser->getId() != $userTalkId && !in_array( $watchingUser->getName(), $wgUsersNotifiedOnAllChanges ) - && !( $wgBlockDisablesLogin && $watchingUser->isBlocked() ) + // @TODO Partial blocks should not prevent the user from logging in. + // see: https://phabricator.wikimedia.org/T208895 + && !( $wgBlockDisablesLogin && $watchingUser->getBlock() ) + && Hooks::run( 'SendWatchlistEmailNotification', [ $watchingUser, $title, $this ] ) ) { - if ( Hooks::run( 'SendWatchlistEmailNotification', [ $watchingUser, $title, $this ] ) ) { - $this->compose( $watchingUser, self::WATCHLIST ); - } + $this->compose( $watchingUser, self::WATCHLIST ); } } } @@ -291,7 +264,9 @@ class EmailNotification { 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() ) { + } elseif ( $wgBlockDisablesLogin && $targetUser->getBlock() ) { + // @TODO Partial blocks should not prevent the user from logging in. + // see: https://phabricator.wikimedia.org/T208895 wfDebug( __METHOD__ . ": talk page owner is blocked and cannot login, no notification sent\n" ); } elseif ( $targetUser->getOption( 'enotifusertalkpages' ) && ( !$minorEdit || $targetUser->getOption( 'enotifminoredits' ) ) @@ -356,8 +331,9 @@ class EmailNotification { $keys['$PAGETITLE'] = $this->title->getPrefixedText(); $keys['$PAGETITLE_URL'] = $this->title->getCanonicalURL(); - $keys['$PAGEMINOREDIT'] = "\n" . ( $this->minorEdit ? - wfMessage( 'enotif_minoredit' )->inContentLanguage()->text() : '' ); + $keys['$PAGEMINOREDIT'] = $this->minorEdit ? + "\n\n" . wfMessage( 'enotif_minoredit' )->inContentLanguage()->text() : + ''; $keys['$UNWATCHURL'] = $this->title->getCanonicalURL( 'action=unwatch' ); if ( $this->editor->isAnon() ) {