Mhutti1 has uploaded a new change for review.

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

Change subject: Made new newsletter email notifications more specific
......................................................................

Made new newsletter email notifications more specific

Changed the subject and body of the email notifications sent by Echo
to be more specific to the newsletter extension.

Bug: T119487
Change-Id: I48637eae6a64da65319b60669e3dddc89880cc02
---
M Newsletter.hooks.php
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/Echo/EchoNewsletterFormatter.php
5 files changed, 21 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/29/261629/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index 4ea8ea4..0b231b7 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -33,11 +33,15 @@
                                
'EchoNewsletterUserLocator::locateNewsletterSubscribedUsers',
                        ),
                        'presentation-model' => 
'EchoNewsletterPresentationModel',
-                       // 'formatter-class' => 'EchoNewsletterFormatter',
+                       'formatter-class' => 'EchoNewsletterFormatter',
                        'title-message' => 'newsletter-notification-title',
                        'title-params' => array( 'newsletter', 'title', 'agent' 
),
                        'flyout-message' => 'newsletter-notification-flyout',
                        'payload' => array( 'summary' ),
+                       'email-subject-message' => 'newsletter-email-subject',
+                       'email-subject-params' => array( 'newsletter' ),
+                       'email-body-batch-message' => 
'newsletter-email-batch-body',
+                       'email-body-batch-params' =>  array( 'newsletter' , 
'agent' ),
                );
 
                return true;
diff --git a/extension.json b/extension.json
index cbdf1f7..a3fdae1 100644
--- a/extension.json
+++ b/extension.json
@@ -60,7 +60,8 @@
                "ApiNewsletterManage": "includes/api/ApiNewsletterManage.php",
                "ApiNewsletterSubscribe": 
"includes/api/ApiNewsletterSubscribe.php",
                "EchoNewsletterPresentationModel": 
"includes/Echo/EchoNewsletterPresentationModel.php",
-               "EchoNewsletterUserLocator": 
"includes/Echo/EchoNewsletterUserLocator.php"
+               "EchoNewsletterUserLocator": 
"includes/Echo/EchoNewsletterUserLocator.php",
+               "EchoNewsletterFormatter": 
"includes/Echo/EchoNewsletterFormatter.php"
        },
        "DefaultUserOptions": {
                "echo-subscriptions-web-newsletter": true,
diff --git a/i18n/en.json b/i18n/en.json
index 2f2013f..7c5f4cc 100755
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -87,6 +87,8 @@
        "newsletter-notification-flyout": "$3 has announced a new issue of $1.",
        "newsletter-notification-link-text-new-issue": "View new issue",
        "newsletter-notification-link-text-view-newsletter": "View newsletter",
+       "newsletter-email-subject": "A new issue of $1 has been announced",
+       "newsletter-email-batch-body": "$2 has announced a new issue of $1",
        "newsletter-header-name": "Name of newsletter",
        "newsletter-header-description": "Description",
        "newsletter-header-action": "Subscribed?",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index d824ab9..46fcd07 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -90,6 +90,8 @@
        "newsletter-notification-flyout": "Used as a Echo notification flyout 
message when a new issue of a newsletter is announced. \n* $1 is the name of 
the newsletter.\n* $2 is title of the issue page.\n* $3 is the username of the 
user who announced the new issue.",
        "newsletter-notification-link-text-new-issue": "Label of the primary 
link of the notification-newsletter-flyout, which on clicking navigates the 
user to the newly announced issue of a newsletter.",
        "newsletter-notification-link-text-view-newsletter": "Label for button 
that links to the newsletter page.",
+       "newsletter-email-subject": "Text of the email subject when a new 
newsletter is announced Parameters:\n* $1 is the name of the newsletter.",
+       "newsletter-email-batch-body" : "First line of the email body when a 
new newsletter is announced Parameters:\n* $1 is the name of the newsletter.\n* 
$2 is the username of the user who announced the new issue.",
        "newsletter-header-name": "Label of the newsletter name column of table 
in [[Special:Newsletters]] which lists the names of newsletters",
        "newsletter-header-description": "Label of the description column of 
table in [[Special:Newsletters]] which displays a description about the 
newsletter\n{{Identical|Description}}",
        "newsletter-header-action": "Label of the subscribe column of table in 
[[Special:Newsletters]] which provides radio buttons to subscribe/unsubscribe 
newsletters\n{{Identical|Subscribed}}",
diff --git a/includes/Echo/EchoNewsletterFormatter.php 
b/includes/Echo/EchoNewsletterFormatter.php
index 20b8389..fa3e2c2 100644
--- a/includes/Echo/EchoNewsletterFormatter.php
+++ b/includes/Echo/EchoNewsletterFormatter.php
@@ -13,10 +13,15 @@
         * @param User $user
         */
        protected function processParam( $event, $param, $message, $user ) {
-               if ( $param === 'newsletter' ) {
-                       $this->processParamEscaped( $message, 
$event->getExtraParam( 'newsletter-name' ) );
-               } else {
-                       parent::processParam( $event, $param, $message, $user );
+               switch ( $param ) {
+                       case 'newsletter':
+                               $this->processParamEscaped( $message, 
$event->getExtraParam( 'newsletter-name' ) );
+                               break;
+                       case 'details':
+                               $this->processParamEscaped( $message, 
$event->getExtraParam( 'section-text' ) );
+                               break;
+                       default:
+                               parent::processParam( $event, $param, $message, 
$user );
                }
        }
 
@@ -41,7 +46,7 @@
                                $target = SpecialPage::getTitleFor( 
'Newsletter', $event->getExtraParam( 'newsletter-id' ) );
                                break;
                        default:
-                               return parent::getLinkParams( $event, $user, 
$destination );
+                               //return parent::getLinkParams( $event, $user, 
$destination );
                }
 
                return array( $target, $query );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48637eae6a64da65319b60669e3dddc89880cc02
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: Mhutti1 <[email protected]>

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

Reply via email to