Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/276044
Change subject: Clean up some code in EchoEmailBatch
......................................................................
Clean up some code in EchoEmailBatch
* Address TODO to use a constant instead of hardcoding
* Don't use deprecated UserMailer::send() calling style
* Only call User::getOption() once
Change-Id: I52d8c3698f8d915ec9d96de0976d242009b3df39
---
M includes/EmailBatch.php
1 file changed, 9 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/44/276044/1
diff --git a/includes/EmailBatch.php b/includes/EmailBatch.php
index a2b184c..48da0a0 100644
--- a/includes/EmailBatch.php
+++ b/includes/EmailBatch.php
@@ -240,8 +240,9 @@
public function sendEmail() {
global $wgNotificationSender, $wgNotificationReplyName;
- // @Todo - replace them with the CONSTANT in 33810 once it is
merged
- if ( $this->mUser->getOption( 'echo-email-frequency' ) == 7 ) {
+ if ( $this->mUser->getOption( 'echo-email-frequency' )
+ == EchoHooks::EMAIL_WEEKLY_DIGEST
+ ) {
$frequency = 'weekly';
$emailDeliveryMode = 'weekly_digest';
} else {
@@ -265,10 +266,11 @@
);
}
+ $userLangCode = $this->mUser->getOption( 'language' );
// email subject
if ( $this->count > self::$displaySize ) {
$count = wfMessage( 'echo-notification-count' )
- ->inLanguage( $this->mUser->getOption(
'language' ) )
+ ->inLanguage( $userLangCode )
->params( self::$displaySize )->text();
} else {
$count = $this->count;
@@ -276,7 +278,7 @@
// Give grep a chance to find the usages:
// echo-email-batch-subject-daily,
echo-email-batch-subject-weekly
$subject = wfMessage( 'echo-email-batch-subject-' . $frequency )
- ->inLanguage( $this->mUser->getOption( 'language' ) )
+ ->inLanguage( $userLangCode )
->params( $count, $this->count )->text();
$toAddress = MailAddress::newFromUser( $this->mUser );
@@ -284,7 +286,9 @@
$replyAddress = new MailAddress( $wgNotificationSender,
$wgNotificationReplyName );
// @Todo Push the email to job queue or just send it out
directly?
- UserMailer::send( $toAddress, $fromAddress, $subject, $body,
$replyAddress );
+ UserMailer::send( $toAddress, $fromAddress, $subject, $body,
array(
+ 'replyTo' => $replyAddress,
+ ) );
MWEchoEventLogging::logSchemaEchoMail( $this->mUser,
$emailDeliveryMode );
}
--
To view, visit https://gerrit.wikimedia.org/r/276044
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I52d8c3698f8d915ec9d96de0976d242009b3df39
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits