Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/254404
Change subject: Notifications presentation models
......................................................................
Notifications presentation models
Bug: T116851
Change-Id: Id1e28bfa96ae097b3f3024159ee9890c41934aaa
---
M BounceHandlerHooks.php
M extension.json
M i18n/en.json
M i18n/qqq.json
A includes/EchoBounceHandlerPresentationModel.php
5 files changed, 43 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler
refs/changes/04/254404/1
diff --git a/BounceHandlerHooks.php b/BounceHandlerHooks.php
index 4fb13b1..9632808 100644
--- a/BounceHandlerHooks.php
+++ b/BounceHandlerHooks.php
@@ -117,6 +117,7 @@
*/
public static function onBeforeCreateEchoEvent( array &$notifications )
{
$notifications['unsubscribe-bouncehandler'] = array(
+ 'presentation-model' =>
'EchoBounceHandlerPresentationModel',
'primary-link' => array(
'message' =>
'notification-link-text-change-email',
'destination' => 'change-email'
diff --git a/extension.json b/extension.json
index e3bcbbb..728ad9b 100644
--- a/extension.json
+++ b/extension.json
@@ -25,7 +25,8 @@
"ProcessBounceWithRegex": "includes/ProcessBounceWithRegex.php",
"VerpAddressGenerator": "includes/VerpAddressGenerator.php",
"PruneOldBounceRecords": "includes/PruneOldBounceRecords.php",
- "EchoBounceHandlerFormatter":
"includes/EchoBounceHandlerFormatter.php"
+ "EchoBounceHandlerFormatter":
"includes/EchoBounceHandlerFormatter.php",
+ "EchoBounceHandlerPresentationModel":
"includes/EchoBounceHandlerPresentationModel.php"
},
"config": {
"BounceHandlerCluster": false,
diff --git a/i18n/en.json b/i18n/en.json
index 4227a0a..d6108a7 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -11,5 +11,6 @@
"apihelp-bouncehandler-param-email": "The bounced email.",
"notification-bouncehandler": "{{GENDER:$1|Your}} registered email
address is no longer valid.",
"notification-bouncehandler-flyout": "{{GENDER:$2|Your}} registered
email address $1 has been unsubscribed due to multiple message delivery
failures. You can [[Special:ConfirmEmail|verify {{GENDER:$2|your}} email
address again]].",
- "notification-link-text-change-email": "Change your email address"
-}
\ No newline at end of file
+ "notification-link-text-change-email": "Change your email address",
+ "notification-header-unsubscribe-bouncehandler": "{{GENDER:$4|Your}}
registered email address $3 has been unsubscribed due to multiple message
delivery failures. You can verify {{GENDER:$4|your}} email address again."
+}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 8e7c49f..1e350fe 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -11,5 +11,6 @@
"apihelp-bouncehandler-param-email":
"{{doc-apihelp-param|bouncehandler|email}}",
"notification-bouncehandler": "Title message of Echo notification to
notify a user of his/her invalid email address. Parameters:\n* $1 is the
username of the user whose email address was unsubscribed. Can be used for
GENDER.",
"notification-bouncehandler-flyout": "Flyout message of Echo
notification to notify the user of his/her invalid email address.
Parameters:\n* $1 is the unsubscribed email address of the user.\n* $2 is the
username of the user whose email address was unsubscribed. Can be used for
GENDER.",
- "notification-link-text-change-email": "Label of the link that points
to Special:ConfirmEmail and Special:ChangeEmail wherein the users are asked to
again verify their old email address."
+ "notification-link-text-change-email": "Label of the link that points
to Special:ConfirmEmail and Special:ChangeEmail wherein the users are asked to
again verify their old email address.",
+ "notification-header-unsubscribe-bouncehandler": "Flyout message of
Echo notification to notify the user of his/her invalid email address.
Parameters:\n* $1 can't be used (there is no agent).\n* $2 can't be used (there
is no agent).\n* $3 is the unsubscribed email address of the user.\n* $4 is the
username of the user whose email address was unsubscribed. Can be used for
GENDER."
}
diff --git a/includes/EchoBounceHandlerPresentationModel.php
b/includes/EchoBounceHandlerPresentationModel.php
new file mode 100644
index 0000000..5faa923
--- /dev/null
+++ b/includes/EchoBounceHandlerPresentationModel.php
@@ -0,0 +1,35 @@
+<?php
+
+class EchoBounceHandlerPresentationModel extends EchoEventPresentationModel {
+ /**
+ * {@inheritdoc}
+ */
+ public function getIconType() {
+ return 'placeholder';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPrimaryLink() {
+ return array(
+ SpecialPage::getTitleFor( 'ConfirmEmail' )->getFullURL(),
+ $this->msg( 'notification-link-text-change-email' )->text()
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getHeaderMessage() {
+ $msg = parent::getHeaderMessage();
+
+ // params 1 & 2 are automatically added by parent, but for this
+ // notification they'll always be null & won't be used in any message;
+ // below messages with be param 3 & 4
+ $msg->params( $this->event->getExtraParam( 'failed-email' ) );
+ $msg->params( $this->getViewingUserForGender() );
+
+ return $msg;
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/254404
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1e28bfa96ae097b3f3024159ee9890c41934aaa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits