Fix broken LoginNotify emails

Take out legacy strings which Echo doesn't use anymore apparently.

Bug: T163742
Change-Id: I26b7c65c798cee376ba4c750851e7e7669d96e01
This commit is contained in:
niharika29 2017-04-28 18:41:18 +00:00
parent b0d0086a4c
commit 970f4bee67
4 changed files with 25 additions and 13 deletions

View file

@ -47,7 +47,6 @@ class LoginNotifyHooks {
// fixme, what does this actually do?
'title-message' => 'loginnotify-login-fail',
'title-params' => [],
'email-subject-message' => 'notification-loginnotify-login-fail-email-subject',
// FIXME Should count be a parameter
'email-subject-params' => [ 'agent', 'count' ],
'email-body-batch-params' => [ 'agent', 'count' ],
@ -57,14 +56,12 @@ class LoginNotifyHooks {
'immediate' => true,
];
$notifications['login-fail-new'] = [
'email-body-batch-message' => 'notification-loginnotify-login-fail-new-emailbatch',
'bundle' => [
'web' => true,
'expandable' => false
]
] + $loginBase;
$notifications['login-fail-known'] = [
'email-body-batch-message' => 'notification-loginnotify-login-fail-known-emailbatch',
'bundle' => [
'web' => true,
'expandable' => false
@ -77,9 +74,6 @@ class LoginNotifyHooks {
];
$notifications['login-success'] = [
'category' => 'login-success',
'email-subject-message' => 'notification-loginnotify-login-success-email-subject',
'email-body-batch-message' => 'notification-loginnotify-login-success-emailbatch',
'email-body-batch-params' => [ 'agent' ],
// FIXME title-message. What is its purpose??
] + $loginBase;
}

View file

@ -17,10 +17,32 @@ class LoginNotifyPresentationModel extends EchoEventPresentationModel {
*/
public function getPrimaryLink() {
return [
'url' => 'https://mediawiki.org/wiki/Help:Login_notifications'
'url' => 'https://mediawiki.org/wiki/Help:Login_notifications',
'label' => $this->msg( 'loginnotify-primary-link' )->text()
];
}
/**
* Define the email subject string
*
* @return string Message string for email subject
*/
public function getSubjectMessage() {
switch ( $this->event->getType() ) {
case 'login-fail-known':
case 'login-fail-new':
$msg = $this->msg( 'notification-loginnotify-login-fail-email-subject' );
$msg->params( $this->getUser()->getName() );
$msg->params( $this->event->getExtraParam( 'count', 0 ) );
break;
default:
$msg = $this->msg( 'notification-loginnotify-login-success-email-subject' );
$msg->params( $this->getUser()->getName() );
break;
}
return $msg;
}
/**
* Include the number of attempts in the message if needed
*

View file

@ -12,12 +12,10 @@
"echo-category-title-login-success": "Login from new computer",
"echo-pref-tooltip-login-success": "Notify me whenever somebody logs into my account from a computer I have not used before.",
"loginnotify-login-fail": "There have been several failed attempts to log in to your account",
"loginnotify-primary-link": "Help information",
"notification-loginnotify-login-fail-email-subject": "{{PLURAL:$2|Failed attempt|Multiple failed attempts}} to log in to {{SITENAME}} as $1",
"notification-loginnotify-login-success-email-subject": "Login to {{SITENAME}} as $1 from a computer you have not recently used",
"notification-header-login-success": "Someone has successfully logged into your account from a computer which you have not edited from recently.",
"notification-loginnotify-login-fail-new-emailbatch": "There {{PLURAL:$2|has been a failed attempt|have been $2 failed attempts}} to log in to your account '$1' on {{SITENAME}}. If it wasn't you, please make sure your account has a strong password.",
"notification-loginnotify-login-fail-known-emailbatch": "There {{PLURAL:$2|has been a failed attempt|have been $2 failed attempts}} to log in to your account, '$1' on {{SITENAME}}. If it wasn't you, please make sure your account has a strong password.",
"notification-loginnotify-login-success-emailbatch": "Someone has successfully logged into your account '$1' on {{SITENAME}} from a computer which you have not edited from recently.",
"notification-new-bundled-header-login-fail": "There {{PLURAL:$1|has been '''a failed attempt'''|have been '''$1 failed attempts'''}} to log in to your account from a new device since the last time you logged in. If it wasn't you, please make sure your account has a strong password.",
"notification-known-header-login-fail": "There have been {{PLURAL:$1|has been '''a failed attempt'''|have been '''$1 failed attempts'''}} to log in to your account since the last time you logged in. If it wasn't you, please make sure your account has a strong password.",
"notification-new-unbundled-header-login-fail": "There {{PLURAL:$1|has been '''a failed attempt'''|have been '''multiple failed attempts'''}} to log in to your account from a new device. Please make sure your account has a strong password."

View file

@ -11,12 +11,10 @@
"echo-category-title-login-success": "Label for 2 checkboxes in the Notifications section of [[Special:Preferences]]. The checkbox controls if the user receives notification on someone logging in to this account from a computer that has not previously been used to log in by this user.",
"echo-pref-tooltip-login-success": "Help tooltip for {{msg-mw|echo-category-title-login-success}}",
"loginnotify-login-fail": "FIXME I have no idea where this message is used.\n{{notranslate}}",
"loginnotify-primary-link": "Label for link to a help page about the feature",
"notification-loginnotify-login-fail-email-subject": "Email subject line for email notice that there have been failed login attempts for the user's account. $1 is the user in question.",
"notification-loginnotify-login-success-email-subject": "Email subject line for email notice that someone has logged in to the user's account from a computer that has not previously been used. $1 is the user in question.",
"notification-header-login-success": "Text of notification for when someone successfully logs in as the current account from a computer that has not been previously used by that account. This is shown in the user's echo notifications, and is possibly emailed to the user.\n* $1 = Username for account, formatted for display\n* $2 = Username for account, unformatted for use in GENDER",
"notification-loginnotify-login-fail-new-emailbatch": "Body of email notification that someone from a computer not previously used by the user has attempted and failed to log into the user's account. Subject of Message is {{msg-mw|notification-loginnotify-login-fail-email-subject}}. $1 is account name. $2 is the number of attempts",
"notification-loginnotify-login-fail-known-emailbatch": "Body of email notification that someone from a computer which has been previously used by the user has attempted and failed to log into the user's account. Subject of Message is {{msg-mw|notification-loginnotify-login-fail-email-subject}}. $1 is account name. $2 is the number of attempts",
"notification-loginnotify-login-success-emailbatch": "Body of email notification that someone from a computer not previously used by the user has succesfully logged into the user's account. Subject of Message is {{msg-mw|notification-loginnotify-login-success-email-subject}}. $1 is account name.",
"notification-new-bundled-header-login-fail": "Message string shown for bundled notifications for login attempts from a new device",
"notification-known-header-login-fail": "Message string shown for known IP notifications",
"notification-new-unbundled-header-login-fail": "Message string shown for individual notifications for login attempts from a new device, when the bundle disperses"