From 44149b6cbd4c0c664c4d9823c7ac9a3bb05bfbdc Mon Sep 17 00:00:00 2001 From: Stephane Bisson Date: Tue, 17 Nov 2015 12:44:45 -0500 Subject: [PATCH] Presentation model for email-user Bug: T116843 Change-Id: I99e790d72c7c534665d1d86c38459c5d0e60b91b --- Echo.php | 3 +-- autoload.php | 1 + i18n/en.json | 2 +- i18n/qqq.json | 2 +- includes/formatters/EmailUserPresentationModel.php | 12 ++++++++++++ 5 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 includes/formatters/EmailUserPresentationModel.php diff --git a/Echo.php b/Echo.php index 7e38a4031..9eae6a8ff 100644 --- a/Echo.php +++ b/Echo.php @@ -411,6 +411,7 @@ $wgEchoNotifications = array( 'icon' => 'site', ), 'emailuser' => array( + 'presentation-model' => 'EchoEmailUserPresentationModel', 'user-locators' => array( array( 'EchoUserLocator::locateFromEventExtra', array( 'to-user-id' ) ), ), @@ -419,8 +420,6 @@ $wgEchoNotifications = array( 'section' => 'alert', 'title-message' => 'notification-emailuser', 'title-params' => array( 'agent' ), - 'flyout-message' => 'notification-emailuser-flyout', - 'flyout-params' => array( 'agent' ), 'icon' => 'site', ), ); diff --git a/autoload.php b/autoload.php index 681690a8b..24e29e3c6 100644 --- a/autoload.php +++ b/autoload.php @@ -44,6 +44,7 @@ $wgAutoloadClasses += array( 'EchoEmailFormatterTest' => __DIR__ . '/tests/phpunit/EmailFormatterTest.php', 'EchoEmailMode' => __DIR__ . '/includes/EmailFormatter.php', 'EchoEmailSingle' => __DIR__ . '/includes/EmailFormatter.php', + 'EchoEmailUserPresentationModel' => __DIR__ . '/includes/formatters/EmailUserPresentationModel.php', 'EchoEvent' => __DIR__ . '/includes/model/Event.php', 'EchoEventFormatter' => __DIR__ . '/includes/formatters/EchoEventFormatter.php', 'EchoEventMapper' => __DIR__ . '/includes/mapper/EventMapper.php', diff --git a/i18n/en.json b/i18n/en.json index 43c97b72b..64781ab55 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -82,7 +82,7 @@ "notification-reverted2": "Your {{PLURAL:$4|edit on [[:$2]] has|edits on [[:$2]] have}} been {{GENDER:$1|reverted}} by [[$5|$1]]. $3", "notification-reverted-flyout2": "Your {{PLURAL:$4|edit on $2 has|edits on $2 have}} been {{GENDER:$1|reverted}} by $1. $3", "notification-emailuser": "[[User:$1|$1]] {{GENDER:$1|sent}} you an email.", - "notification-emailuser-flyout": "$1 {{GENDER:$1|sent}} you an email", + "notification-header-emailuser": "$1 {{GENDER:$2|sent}} you an email", "notification-edit-talk-page-email-subject2": "$1 {{GENDER:$1|left}} you a message on {{SITENAME}}", "notification-edit-talk-page-email-batch-body2": "$1 {{GENDER:$1|left}} a message on your talk page.", "notification-edit-talk-page-email-batch-body-with-section": "$1 {{GENDER:$1|left}} a message on your talk page in \"$2\".", diff --git a/i18n/qqq.json b/i18n/qqq.json index b66dfcb98..7c4625e26 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -103,7 +103,7 @@ "notification-reverted2": "Format for displaying notifications of a user's edit being reverted. Parameters:\n* $1 - the username of the person who reverted, plain text. Can be used for GENDER.\n* $2 - the page that was reverted, formatted\n* $3 - a diff link which is labeled {{msg-mw|Showdiff}}\n* $4 - the number of edits that were reverted. NOTE: This will only be set to 1 or 2, with 2 actually meaning 'an unknown number greater than 0'.\n* $5 - Page for reverting user.\nUser page if logged in, or user's contributions page if logged out.\n{{Related|Notification-reverted}}", "notification-reverted-flyout2": "Flyout-specific format for displaying notifications of a user's edit being reverted.\n\nParameters:\n* $1 - the username of the person who reverted, plain text. Can be used for GENDER.\n* $2 - the page that was reverted, formatted\n* $3 - a diff link which is labeled {{msg-mw|Showdiff}}\n* $4 - the number of edits that were reverted. NOTE: This will only be set to 1 or 2, with 2 actually meaning \"an unknown number greater than 0\".\n{{Related|Notification-reverted}}", "notification-emailuser": "Format for displaying notifications of a user has sent an email to another user. Parameters:\n* $1 - the username of the person the email, plain text. Can be used for GENDER.", - "notification-emailuser-flyout": "Flyout-specific format for displaying notifications of user has sent an email to another user.\n\nParameters:\n* $1 - the username of the person who sent the email, plain text. Can be used for GENDER.", + "notification-header-emailuser": "Flyout-specific format for displaying notifications of user has sent an email to another user.\n\nParameters:\n* $1 - the formatted username of the person who sent the email.\n* $2 - the username for GENDER.", "notification-edit-talk-page-email-subject2": "Email subject. Parameters:\n* $1 - a username which can be used for gender support", "notification-edit-talk-page-email-batch-body2": "First line of the email notification for a talk page edit. The following line completes it with the description of the message in question, that is its edit summary.\n\nParameters:\n* $1 - a username (which also links to the userpage of the user in question, in the HTML version)\nSee also:\n* {{msg-mw|Notification-edit-talk-page2}}\n* {{msg-mw|Notification-edit-talk-page-email-subject2}}\n* {{msg-mw|Notification-edit-talk-page-flyout2}}", "notification-edit-talk-page-email-batch-body-with-section": "Email notification for talk page edit with new section or new comment. Parameters:\n* $1 - a username\n* $2 - the raw section title text", diff --git a/includes/formatters/EmailUserPresentationModel.php b/includes/formatters/EmailUserPresentationModel.php new file mode 100644 index 000000000..6eb49dfd4 --- /dev/null +++ b/includes/formatters/EmailUserPresentationModel.php @@ -0,0 +1,12 @@ +