Lwelling has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/59640


Change subject: Split out notification emails to a separate from address so 
they can be configured as specified for launch.
......................................................................

Split out notification emails to a separate from address so they can
be configured as specified for launch.

Part of https://bugzilla.wikimedia.org/show_bug.cgi?id=46670

Change-Id: I06a73aae95bc4b6776a0554b624eccfc4602bc65
---
M Notifier.php
M includes/EmailBatch.php
M includes/EmailBundler.php
3 files changed, 15 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/40/59640/1

diff --git a/Notifier.php b/Notifier.php
index 5177d0a..2ca3f96 100644
--- a/Notifier.php
+++ b/Notifier.php
@@ -65,7 +65,7 @@
 
                // See if the user wants to receive emails for this category
                if ( $user->getOption( 'echo-subscriptions-email-' . 
$event->getCategory() ) ) {
-                       global $wgEchoEnableEmailBatch, $wgEchoNotifications, 
$wgPasswordSender, $wgPasswordSenderName, $wgEchoBundleEmailInterval;
+                       global $wgEchoEnableEmailBatch, $wgEchoNotifications, 
$wgNotificationSender, $wgNotificationSenderName, $wgNotificationReplyName, 
$wgEchoBundleEmailInterval;
 
                        $priority = 
EchoNotificationController::getNotificationPriority( $event->getType() );
 
@@ -108,8 +108,9 @@
                        // send single notification if the email wasn't added 
to queue for bundling
                        if ( !$addedToQueue ) {
                                // instant email notification
-                               $adminAddress = new MailAddress( 
$wgPasswordSender, $wgPasswordSenderName );
-                               $address = new MailAddress( $user );
+                               $toAddress = new MailAddress( $user );
+                               $fromAddress = new MailAddress( 
$wgNotificationSender, $wgNotificationSenderName );
+                               $replyAddress = new MailAddress( 
$wgNotificationSender, $wgNotificationReplyName );
                                // Since we are sending a single email, should 
set the bundle hash to null
                                // if it is set with a value from somewhere else
                                $event->setBundleHash( null );
@@ -117,7 +118,7 @@
                                $subject = $email['subject'];
                                $body = $email['body'];
 
-                               UserMailer::send( $address, $adminAddress, 
$subject, $body );
+                               UserMailer::send( $toAddress, $fromAddress, 
$subject, $body, $replyAddress);
                        }
                }
 
diff --git a/includes/EmailBatch.php b/includes/EmailBatch.php
index 8caf9b5..750b481 100644
--- a/includes/EmailBatch.php
+++ b/includes/EmailBatch.php
@@ -217,7 +217,7 @@
         * Send the batch email
         */
        public function sendEmail() {
-               global $wgPasswordSender, $wgPasswordSenderName, 
$wgEchoEmailFooterAddress;
+               global $wgNotificationSender, $wgNotificationSenderName, 
$wgNotificationReplyName, $wgEchoEmailFooterAddress;
 
                // global email footer
                $footer = wfMessage( 'echo-email-footer-default' )
@@ -247,11 +247,12 @@
                                $footer
                        )->text();
 
-               $adminAddress = new MailAddress( $wgPasswordSender, 
$wgPasswordSenderName );
-               $address = new MailAddress( $this->mUser );
+               $toAddress = new MailAddress( $this->mUser );
+               $fromAddress = new MailAddress( $wgNotificationSender, 
$wgNotificationSenderName );
+               $replyAddress = new MailAddress( $wgNotificationSender, 
$wgNotificationReplyName );
 
                // @Todo Push the email to job queue or just send it out 
directly?
-               UserMailer::send( $address, $adminAddress, $subject, $body );
+               UserMailer::send( $toAddress, $fromAddress, $subject, $body, 
$replyAddress );
        }
 
        /**
diff --git a/includes/EmailBundler.php b/includes/EmailBundler.php
index 7b96cd6..0008de6 100644
--- a/includes/EmailBundler.php
+++ b/includes/EmailBundler.php
@@ -244,13 +244,14 @@
                        return;
                }
 
-               global $wgPasswordSender, $wgPasswordSenderName;
+               global $wgNotificationSender, $wgNotificationSenderName, 
$wgNotificationReplyName;
 
-               $adminAddress = new MailAddress( $wgPasswordSender, 
$wgPasswordSenderName );
-               $address = new MailAddress( $this->mUser );
+               $toAddress = new MailAddress( $this->mUser );
+               $fromAddress = new MailAddress( $wgNotificationSender, 
$wgNotificationSenderName );
+               $replyAddress = new MailAddress( $wgNotificationSender, 
$wgNotificationReplyName );
 
                // Schedule a email job or just send the email directly?
-               UserMailer::send( $address, $adminAddress, $content['subject'], 
$content['body'] );
+               UserMailer::send( $toAddress, $fromAddress, 
$content['subject'], $content['body'], $replyAddress );
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/59640
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I06a73aae95bc4b6776a0554b624eccfc4602bc65
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Lwelling <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to