jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/350889 )
Change subject: Fix broken LoginNotify emails ...................................................................... Fix broken LoginNotify emails Take out legacy strings which Echo doesn't use anymore apparently. Bug: T163742 Change-Id: I26b7c65c798cee376ba4c750851e7e7669d96e01 --- M LoginNotify.hooks.php M LoginNotifyPresentationModel.php M i18n/en.json M i18n/qqq.json 4 files changed, 25 insertions(+), 13 deletions(-) Approvals: jenkins-bot: Verified Kaldari: Looks good to me, approved diff --git a/LoginNotify.hooks.php b/LoginNotify.hooks.php index 6b78afc..7b31631 100644 --- a/LoginNotify.hooks.php +++ b/LoginNotify.hooks.php @@ -47,7 +47,6 @@ // 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 @@ '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 @@ ]; $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; } diff --git a/LoginNotifyPresentationModel.php b/LoginNotifyPresentationModel.php index f3ec6e7..e061d50 100644 --- a/LoginNotifyPresentationModel.php +++ b/LoginNotifyPresentationModel.php @@ -17,11 +17,33 @@ */ 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 * * @return Message diff --git a/i18n/en.json b/i18n/en.json index b150f98..7185f93 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -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." diff --git a/i18n/qqq.json b/i18n/qqq.json index 9a749c5..a1c95d3 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -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" -- To view, visit https://gerrit.wikimedia.org/r/350889 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I26b7c65c798cee376ba4c750851e7e7669d96e01 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/LoginNotify Gerrit-Branch: master Gerrit-Owner: Niharika29 <nko...@wikimedia.org> Gerrit-Reviewer: Kaldari <rkald...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits