mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-30 18:45:07 +00:00
Merge "Split out notification emails to a separate from address so they can be configured as specified for launch."
This commit is contained in:
commit
a534f7b239
8
Echo.php
8
Echo.php
|
@ -218,6 +218,14 @@ $wgEchoUseJobQueue = false;
|
||||||
// The organization address, the value should be defined in LocalSettings.php
|
// The organization address, the value should be defined in LocalSettings.php
|
||||||
$wgEchoEmailFooterAddress = '';
|
$wgEchoEmailFooterAddress = '';
|
||||||
|
|
||||||
|
// The email address for both "from" and "reply to" on email notifications.
|
||||||
|
// Should be defined in LocalSettings.php
|
||||||
|
$wgNotificationSender = $wgPasswordSender;
|
||||||
|
// Name for "from" on email notifications. Should be defined in LocalSettings.php
|
||||||
|
$wgNotificationSenderName = $wgPasswordSenderName;
|
||||||
|
// Name for "reply to" on email notifications. Should be defined in LocalSettings.php
|
||||||
|
$wgNotificationReplyName = 'No Reply';
|
||||||
|
|
||||||
// Use the main db if this is set to false, to use a specific external db, just
|
// Use the main db if this is set to false, to use a specific external db, just
|
||||||
// use any key defined in $wgExternalServers
|
// use any key defined in $wgExternalServers
|
||||||
$wgEchoCluster = false;
|
$wgEchoCluster = false;
|
||||||
|
|
|
@ -65,7 +65,7 @@ class EchoNotifier {
|
||||||
|
|
||||||
// See if the user wants to receive emails for this category
|
// See if the user wants to receive emails for this category
|
||||||
if ( $user->getOption( 'echo-subscriptions-email-' . $event->getCategory() ) ) {
|
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() );
|
$priority = EchoNotificationController::getNotificationPriority( $event->getType() );
|
||||||
|
|
||||||
|
@ -108,8 +108,9 @@ class EchoNotifier {
|
||||||
// send single notification if the email wasn't added to queue for bundling
|
// send single notification if the email wasn't added to queue for bundling
|
||||||
if ( !$addedToQueue ) {
|
if ( !$addedToQueue ) {
|
||||||
// instant email notification
|
// instant email notification
|
||||||
$adminAddress = new MailAddress( $wgPasswordSender, $wgPasswordSenderName );
|
$toAddress = new MailAddress( $user );
|
||||||
$address = 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
|
// Since we are sending a single email, should set the bundle hash to null
|
||||||
// if it is set with a value from somewhere else
|
// if it is set with a value from somewhere else
|
||||||
$event->setBundleHash( null );
|
$event->setBundleHash( null );
|
||||||
|
@ -117,7 +118,7 @@ class EchoNotifier {
|
||||||
$subject = $email['subject'];
|
$subject = $email['subject'];
|
||||||
$body = $email['body'];
|
$body = $email['body'];
|
||||||
|
|
||||||
UserMailer::send( $address, $adminAddress, $subject, $body );
|
UserMailer::send( $toAddress, $fromAddress, $subject, $body, $replyAddress );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ abstract class MWEchoEmailBatch {
|
||||||
* Send the batch email
|
* Send the batch email
|
||||||
*/
|
*/
|
||||||
public function sendEmail() {
|
public function sendEmail() {
|
||||||
global $wgPasswordSender, $wgPasswordSenderName, $wgEchoEmailFooterAddress;
|
global $wgNotificationSender, $wgNotificationSenderName, $wgNotificationReplyName, $wgEchoEmailFooterAddress;
|
||||||
|
|
||||||
// global email footer
|
// global email footer
|
||||||
$footer = wfMessage( 'echo-email-footer-default' )
|
$footer = wfMessage( 'echo-email-footer-default' )
|
||||||
|
@ -247,11 +247,12 @@ abstract class MWEchoEmailBatch {
|
||||||
$footer
|
$footer
|
||||||
)->text();
|
)->text();
|
||||||
|
|
||||||
$adminAddress = new MailAddress( $wgPasswordSender, $wgPasswordSenderName );
|
$toAddress = new MailAddress( $this->mUser );
|
||||||
$address = 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?
|
// @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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -241,13 +241,14 @@ abstract class MWEchoEmailBundler {
|
||||||
throw new MWException( "Fail to create bundle email content!" );
|
throw new MWException( "Fail to create bundle email content!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
global $wgPasswordSender, $wgPasswordSenderName;
|
global $wgNotificationSender, $wgNotificationSenderName, $wgNotificationReplyName;
|
||||||
|
|
||||||
$adminAddress = new MailAddress( $wgPasswordSender, $wgPasswordSenderName );
|
$toAddress = new MailAddress( $this->mUser );
|
||||||
$address = new MailAddress( $this->mUser );
|
$fromAddress = new MailAddress( $wgNotificationSender, $wgNotificationSenderName );
|
||||||
|
$replyAddress = new MailAddress( $wgNotificationSender, $wgNotificationReplyName );
|
||||||
|
|
||||||
// Schedule a email job or just send the email directly?
|
// 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue