jenkins-bot has submitted this change and it was merged.

Change subject: Email digest header tweaks
......................................................................


Email digest header tweaks

Plus adding escape to some of the messages

Bug: 47095
Change-Id: I296de4e5ebe92b737837c7ddcf3f631b16a9cf8b
---
M Echo.i18n.php
M Hooks.php
M formatters/BasicFormatter.php
M includes/EmailBatch.php
4 files changed, 46 insertions(+), 40 deletions(-)

Approvals:
  Lwelling: Looks good to me, but someone else must approve
  Kaldari: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Echo.i18n.php b/Echo.i18n.php
index 18f6854..06a31f4 100644
--- a/Echo.i18n.php
+++ b/Echo.i18n.php
@@ -30,12 +30,12 @@
        'echo-dismiss-prefs-message' => 'You can turn these back on in 
Preferences',
 
        // Category titles
-       'echo-category-title-edit-user-talk' => 'Talk page post',
-       'echo-category-title-article-linked' => 'Page link',
-       'echo-category-title-reverted' => 'Edit revert',
-       'echo-category-title-mention' => 'Mention',
-       'echo-category-title-other' => 'Other',
-       'echo-category-title-system' => 'System',
+       'echo-category-title-edit-user-talk' => 'Talk page 
{{PLURAL:$1|post|posts}}',
+       'echo-category-title-article-linked' => 'Page {{PLURAL:$1|link|links}}',
+       'echo-category-title-reverted' => 'Edit {{PLURAL:$1|revert|reverts}}',
+       'echo-category-title-mention' => '{{PLURAL:$1|Mention|Mentions}}',
+       'echo-category-title-other' => '{{PLURAL:$1|Other}}',
+       'echo-category-title-system' => '{{PLURAL:$1|System}}',
 
        // Errors
        'echo-no-agent' => '[Nobody]',
@@ -159,11 +159,11 @@
        // Email batch
        'echo-email-batch-separator' => 
'________________________________________________', # only translate this 
message to other languages if you have to change it
        'echo-email-batch-bullet' => '•', # only translate this message to 
other languages if you have to change it
-       'echo-email-batch-subject-daily' => 'You have $1 
{{PLURAL:$2|notification|notifications}} today',
-       'echo-email-batch-subject-weekly' => 'You have $1 
{{PLURAL:$2|notification|notifications}} this week',
+       'echo-email-batch-subject-daily' => 'You have new 
{{PLURAL:$2|notification|notifications}} today',
+       'echo-email-batch-subject-weekly' => 'You have new 
{{PLURAL:$2|notification|notifications}} this week',
        'echo-email-batch-body-daily' => '$1,
 
-You have $2 {{PLURAL:$3|notification|notifications}} on {{SITENAME}} today.  
View them here:
+You have new {{PLURAL:$3|notification|notifications}} on {{SITENAME}} today.  
View them here:
 {{canonicalurl:{{#special:Notifications}}}}
 
 $4
@@ -171,13 +171,12 @@
 $5',
        'echo-email-batch-body-weekly' => '$1,
 
-You have $2 {{PLURAL:$3|notification|notifications}} on {{SITENAME}} this 
week.  View them here:
+You have new {{PLURAL:$3|notification|notifications}} on {{SITENAME}} this 
week.  View them here:
 {{canonicalurl:{{#special:Notifications}}}}
 
 $4
 
 $5',
-       'echo-email-batch-category-header' => '$1 $2 
{{PLURAL:$1|notification|notifications}}',
 );
 
 /** Message documentation (Message documentation)
@@ -226,16 +225,22 @@
 ** {{msg-mw|Echo-category-title-other}}
 ** {{msg-mw|Echo-category-title-system}}',
        'echo-dismiss-prefs-message' => 'Used in Dismiss interface.',
-       'echo-category-title-edit-user-talk' => 'This is a short title for 
notification category. Used as <code>$1</code> in 
{{msg-mw|Echo-dismiss-message}} and <code>$2</code> in 
{{msg-mw|Echo-email-batch-category-header}}.',
-       'echo-category-title-article-linked' => 'This is a short title for 
notification category. Used as <code>$1</code> in 
{{msg-mw|Echo-dismiss-message}} and <code>$2</code> in 
{{msg-mw|Echo-email-batch-category-header}}.',
-       'echo-category-title-reverted' => 'This is a short title for 
notification category. Used as <code>$1</code> in 
{{msg-mw|Echo-dismiss-message}} and <code>$2</code> in 
{{msg-mw|Echo-email-batch-category-header}}.',
-       'echo-category-title-mention' => 'This is a short title for 
notification category. Used as <code>$1</code> in 
{{msg-mw|Echo-dismiss-message}} and <code>$2</code> in 
{{msg-mw|Echo-email-batch-category-header}}.',
+       'echo-category-title-edit-user-talk' => 'This is a short title for 
notification category. Used as <code>$1</code> in 
{{msg-mw|Echo-dismiss-message}} and <code>$2</code> in 
{{msg-mw|Echo-email-batch-category-header}}. Parameters:
+* $1 - the number used for plural support',
+       'echo-category-title-article-linked' => 'This is a short title for 
notification category. Used as <code>$1</code> in 
{{msg-mw|Echo-dismiss-message}} and <code>$2</code> in 
{{msg-mw|Echo-email-batch-category-header}}. Parameters:
+* $1 - the number used for plural support',
+       'echo-category-title-reverted' => 'This is a short title for 
notification category. Used as <code>$1</code> in 
{{msg-mw|Echo-dismiss-message}} and <code>$2</code> in 
{{msg-mw|Echo-email-batch-category-header}}. Parameters:
+* $1 - the number used for plural support',
+       'echo-category-title-mention' => 'This is a short title for 
notification category. Used as <code>$1</code> in 
{{msg-mw|Echo-dismiss-message}} and <code>$2</code> in 
{{msg-mw|Echo-email-batch-category-header}}. Parameters:
+* $1 - the number used for plural support',
        'echo-category-title-other' => 'This is a short title for notification 
category.
 
 Used as <code>$1</code> in {{msg-mw|Echo-dismiss-message}} and <code>$2</code> 
in {{msg-mw|Echo-email-batch-category-header}}.
-{{Identical|Other}}',
+{{Identical|Other}} Parameters:
+* $1 - the number used for plural support',
        'echo-category-title-system' => 'This is a short title for notification 
category. Used as <code>$1</code> in {{msg-mw|Echo-dismiss-message}} and 
<code>$2</code> in {{msg-mw|Echo-email-batch-category-header}}.
-{{Identical|System}}',
+{{Identical|System}} Parameters:
+* $1 - the number used for plural support',
        'echo-no-agent' => 'Shown in place of a username in a notification
        if the notification has no specified user.',
        'echo-no-title' => 'Shown in place of a page title in a notification if 
the notification has no specified page title.',
@@ -472,18 +477,18 @@
 Email batch content separator',
        'echo-email-batch-bullet' => '{{optional}}',
        'echo-email-batch-subject-daily' => 'Daily e-mail batch subject.
-* $1 could be a numeric count or "10+". See also: 
{{msg-mw|echo-notification-count|optional message|notext=1}}.
+* $1 is currently not used, could be a numeric count or "10+". See also: 
{{msg-mw|echo-notification-count|optional message|notext=1}}.
 * $2 is a numeric count, this is used for plural support
 See also:
 * {{msg-mw|Echo-email-batch-subject-weekly}}',
        'echo-email-batch-subject-weekly' => 'Weekly e-mail batch subject.
-* $1 could be a numeric count or "10+". See also: 
{{msg-mw|echo-notification-count|optional message|notext=1}}
+* $1 is currently not used, could be a numeric count or "10+". See also: 
{{msg-mw|echo-notification-count|optional message|notext=1}}
 * $2 is a numeric count, this is used for plural support
 See also:
 * {{msg-mw|Echo-email-batch-subject-daily}}',
        'echo-email-batch-body-daily' => 'Daily e-mail batch body. Parameters:
 * $1 is a username
-* $2 could be a numeric count or "10+". See also: 
{{msg-mw|echo-notification-count|optional message|notext=1}}.
+* $2 is currently not used, could be a numeric count or "10+". See also: 
{{msg-mw|echo-notification-count|optional message|notext=1}}.
 * $3 is a numeric count, this is used for plural support
 * $4 is the e-mail batch content separated by "-------..." 
({{msg-mw|echo-email-batch-separator}})
 * $5 is the e-mail footer, {{msg-mw|echo-email-footer-default}}
@@ -491,7 +496,7 @@
 * {{msg-mw|Echo-email-batch-body-weekly}}',
        'echo-email-batch-body-weekly' => 'Weekly e-mail batch body. Parameters:
 * $1 is a username
-* $2 could be a numeric count or "10+". See also: 
{{msg-mw|echo-notification-count|optional message|notext=1}}.
+* $2 is currently not used, could be a numeric count or "10+". See also: 
{{msg-mw|echo-notification-count|optional message|notext=1}}.
 * $3 is a numeric count, this is used for plural support
 * $4 is the e-mail batch content separated by "--------..." 
({{msg-mw|echo-email-batch-separator}})
 * $5 is the e-mail footer, {{msg-mw|echo-email-footer-default}}
diff --git a/Hooks.php b/Hooks.php
index 399ed73..3efecdb 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -331,14 +331,14 @@
                // Build the columns (output formats)
                $columns = array();
                foreach ( $wgEchoNotifiers as $notifierType => $notifierData ) {
-                       $formatMessage = wfMessage( 'echo-pref-' . 
$notifierType )->plain();
+                       $formatMessage = wfMessage( 'echo-pref-' . 
$notifierType )->escaped();
                        $columns[$formatMessage] = $notifierType;
                }
 
                // Build the rows (notification categories)
                $rows = array();
                foreach ( $validSortedCategories as $category ) {
-                       $categoryMessage = wfMessage( 'echo-category-title-' . 
$category )->plain();
+                       $categoryMessage = wfMessage( 'echo-category-title-' . 
$category )->numParams( 1 )->escaped();
                        $rows[$categoryMessage] = $category;
                }
 
diff --git a/formatters/BasicFormatter.php b/formatters/BasicFormatter.php
index c50539c..d276ccb 100644
--- a/formatters/BasicFormatter.php
+++ b/formatters/BasicFormatter.php
@@ -211,16 +211,19 @@
         * @return string
         */
        protected function formatDismissInterface( $event, $user ) {
+               $userLanguage = $user->getOption( 'language' );
+
                $dismissTitle = wfMessage( 'echo-category-title-' . 
$event->getCategory() )
-                       ->inLanguage( $user->getOption( 'language' ) )
-                       ->escaped();
-               $dismissMessage = wfMessage( 'echo-dismiss-message', 
$dismissTitle )
-                       ->inLanguage( $user->getOption( 'language' ) )
+                       ->inLanguage( $userLanguage )
+                       ->numParams( 1 )
                        ->text();
+               $dismissMessage = wfMessage( 'echo-dismiss-message', 
$dismissTitle )
+                       ->inLanguage( $userLanguage )
+                       ->escaped();
                $dismiss = Xml::tags( 'div', array( 'class' => 
'mw-echo-dismiss-message' ), $dismissMessage ) . "\n";
                $prefsMessage = wfMessage( 'echo-dismiss-prefs-message' )
-                       ->inLanguage( $user->getOption( 'language' ) )
-                       ->text();
+                       ->inLanguage( $userLanguage )
+                       ->escaped();
                $dismiss .= Xml::tags( 'div', array( 'class' => 
'mw-echo-prefs-dismiss-message' ), $prefsMessage ) . "\n";
                $dismiss = Xml::tags( 'div', array( 'class' => 
'mw-echo-dismiss', 'style' => 'display:none;' ), $dismiss ) . "\n";
                return $dismiss;
diff --git a/includes/EmailBatch.php b/includes/EmailBatch.php
index 8caf9b5..e7f28ed 100644
--- a/includes/EmailBatch.php
+++ b/includes/EmailBatch.php
@@ -180,17 +180,15 @@
                $result = array();
                // build the text section for each category
                foreach( $this->content as $category => $notifs ) {
-                       $output = wfMessage( 'echo-email-batch-category-header' 
)
-                                       ->numParams( count( $notifs ) )
-                                       // Messages that can be used here:
-                                       // * echo-category-title-system
-                                       // * echo-category-title-other
-                                       // * echo-category-title-edit-user-talk
-                                       // * echo-category-title-reverted
-                                       // * echo-category-title-article-linked
-                                       // * echo-category-title-mention
-                                       ->params( wfMessage( 
'echo-category-title-' . $category )->text() )
-                                       ->text() . "\n";
+                       // Messages that can be used here:
+                       // * echo-category-title-system
+                       // * echo-category-title-other
+                       // * echo-category-title-edit-user-talk
+                       // * echo-category-title-reverted
+                       // * echo-category-title-article-linked
+                       // * echo-category-title-mention
+                       $output = wfMessage( 'echo-category-title-' . $category 
)->numParams( count( $notifs ) )->text() . "\n";
+
                        foreach( $notifs as $notif ) {
                                $output .= "\n " . wfMessage( 
'echo-email-batch-bullet' )->text() . ' ' . $notif;
                        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I296de4e5ebe92b737837c7ddcf3f631b16a9cf8b
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: Bsitu <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Lwelling <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to