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

Change subject: [WIP/UNTESTED] Support for proper HTML emails
......................................................................


[WIP/UNTESTED] Support for proper HTML emails

At least MW 1.26, the current stable (and thus the only supported) version
of MW, supports HTML emails by passing an array as $body (4th param) to
UserMailer::send(). This also allows us to use User::sendMail() instead of
having to hack around it (especially since the hacks didn't even work
properly, for whatever reason(s)).

HT Skizzerz

References Bug: T70045

Change-Id: Ia66c90fef70e9199fd8625b1b38dcde13b3ff6a3
---
M SystemGifts/UserSystemGiftsClass.php
M SystemGifts/i18n/en.json
M SystemGifts/i18n/fi.json
M UserBoard/UserBoardClass.php
M UserBoard/i18n/en.json
M UserBoard/i18n/fi.json
M UserGifts/UserGiftsClass.php
M UserGifts/i18n/en.json
M UserGifts/i18n/fi.json
M UserRelationship/UserRelationshipClass.php
M UserRelationship/i18n/en.json
M UserRelationship/i18n/fi.json
M UserStats/i18n/en.json
M UserStats/i18n/fi.json
M UserSystemMessages/UserSystemMessagesClass.php
15 files changed, 168 insertions(+), 140 deletions(-)

Approvals:
  Jack Phoenix: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/SystemGifts/UserSystemGiftsClass.php 
b/SystemGifts/UserSystemGiftsClass.php
index 626fb9a..e213adf 100644
--- a/SystemGifts/UserSystemGiftsClass.php
+++ b/SystemGifts/UserSystemGiftsClass.php
@@ -80,22 +80,22 @@
                        } else {
                                $name = $user->getName();
                        }
-                       $body = wfMessage( 'system_gift_received_body',
-                               $name,
-                               $gift['gift_name'],
-                               $gift['gift_description'],
-                               $gifts_link->getFullURL(),
-                               $update_profile_link->getFullURL()
-                       )->text();
+                       $body = array(
+                               'html' => wfMessage( 
'system_gift_received_body_html',
+                                       $name,
+                                       $gift['gift_name'],
+                                       $gift['gift_description']
+                               )->parse(),
+                               'text' => wfMessage( 
'system_gift_received_body',
+                                       $name,
+                                       $gift['gift_name'],
+                                       $gift['gift_description'],
+                                       $gifts_link->getFullURL(),
+                                       $update_profile_link->getFullURL()
+                               )->text()
+                       );
 
-                       // The email contains HTML, so actually send it out as 
such, too.
-                       // That's why this no longer uses User::sendMail().
-                       // @see https://phabricator.wikimedia.org/T70045
-                       global $wgPasswordSender;
-                       $sender = new MailAddress( $wgPasswordSender,
-                               wfMessage( 'emailsender' 
)->inContentLanguage()->text() );
-                       $to = new MailAddress( $user );
-                       UserMailer::send( $to, $sender, $subject, $body, array( 
'contentType' => 'text/html; charset=UTF-8' ) );
+                       $user->sendMail( $subject, $body );
                }
        }
 
diff --git a/SystemGifts/i18n/en.json b/SystemGifts/i18n/en.json
index f360413..487c9ac 100644
--- a/SystemGifts/i18n/en.json
+++ b/SystemGifts/i18n/en.json
@@ -69,6 +69,7 @@
        "topawards-friend-milestone": "{{PLURAL:$1|$1 Friend|$1 Friends}} 
Milestone",
        "topawards-empty": "Either there are no configured awards for this 
award category, or then nobody has gotten those awards yet.",
        "system_gift_received_subject": "You have received the $1 award on 
{{SITENAME}}!",
+       "system_gift_received_body_html": "Hi $1.\n\nYou have just received the 
$2 award on {{SITENAME}}!\n\n\"$3\"\n\nClick below to check out your trophy 
case!\n\n[[Special:ViewSystemGifts]]\n\nWe hope you like 
it!\n\nThanks,\n\n\nThe {{SITENAME}} team\n\n---\n\nHey, want to stop getting 
emails from us?\n\nClick [[Special:UpdateProfile]]\nand change your settings to 
disable email notifications.",
        "system_gift_received_body": "Hi $1.\n\nYou have just received the $2 
award on {{SITENAME}}!\n\n\"$3\"\n\nClick below to check out your trophy 
case!\n\n$4\n\nWe hope you like it!\n\nThanks,\n\n\nThe {{SITENAME}} 
team\n\n---\n\nHey, want to stop getting emails from us?\n\nClick $5\nand 
change your settings to disable email notifications.",
        "right-awardsmanage": "Create new and edit existing awards"
 }
diff --git a/SystemGifts/i18n/fi.json b/SystemGifts/i18n/fi.json
index a062d02..7d9b0c7 100644
--- a/SystemGifts/i18n/fi.json
+++ b/SystemGifts/i18n/fi.json
@@ -51,6 +51,7 @@
        "ga-user-got-awards": "$1 sai palkinnon $2",
        "ga-awards-given-out": "{{PLURAL:$1|Yksi palkinto|$1 palkintoa}} 
jaettiin",
        "system_gift_received_subject": "Olet saanut palkinnon $1 
{{GRAMMAR:inessive|{{SITENAME}}}}!",
+       "system_gift_received_body_html": "Hei $1:\n\nOlet juuri saanut 
$2-palkinnon {{GRAMMAR:inessive|{{SITENAME}}}}!\n\n\"$3\"\n\nNapsauta 
alapuolella olevaa linkkiä tarkistaaksesi 
palkintorasiasi!\n\n[[Special:ViewSystemGifts]]\n\nToivomme, että pidät 
siitä!\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} tiimi\n\n---\n\nHei, 
etkö halua enää saada sähköposteja meiltä?\n\nNapsauta 
[[Special:UpdateProfile]]\nja muuta asetuksiasi poistaaksesi 
sähköpostitoiminnot käytöstä.",
        "system_gift_received_body": "Hei $1:\n\nOlet juuri saanut $2-palkinnon 
{{GRAMMAR:inessive|{{SITENAME}}}}!\n\n\"$3\"\n\nNapsauta alapuolella olevaa 
linkkiä tarkistaaksesi palkintorasiasi!\n\n$4\n\nToivomme, että pidät 
siitä!\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} tiimi\n\n---\n\nHei, 
etkö halua enää saada sähköposteja meiltä?\n\nNapsauta $5\nja muuta asetuksiasi 
poistaaksesi sähköpostitoiminnot käytöstä.",
        "right-awardsmanage": "Luoda uusia ja muokata olemassaolevia palkintoja"
 }
diff --git a/UserBoard/UserBoardClass.php b/UserBoard/UserBoardClass.php
index 9c6b301..d2a5aa0 100644
--- a/UserBoard/UserBoardClass.php
+++ b/UserBoard/UserBoardClass.php
@@ -78,21 +78,20 @@
                        $board_link = SpecialPage::getTitleFor( 'UserBoard' );
                        $update_profile_link = SpecialPage::getTitleFor( 
'UpdateProfile' );
                        $subject = wfMessage( 'message_received_subject', 
$user_from )->parse();
-                       $body = wfMessage( 'message_received_body',
-                               $user->getName(),
-                               $user_from,
-                               htmlspecialchars( $board_link->getFullURL() ),
-                               htmlspecialchars( 
$update_profile_link->getFullURL() )
-                       )->text();
+                       $body = array(
+                               'html' => wfMessage( 
'message_received_body_html',
+                                       $user->getName(),
+                                       $user_from
+                               )->parse(),
+                               'text' => wfMessage( 'message_received_body',
+                                       $user->getName(),
+                                       $user_from,
+                                       htmlspecialchars( 
$board_link->getFullURL() ),
+                                       htmlspecialchars( 
$update_profile_link->getFullURL() )
+                               )->text()
+                       );
 
-                       // The email contains HTML, so actually send it out as 
such, too.
-                       // That's why this no longer uses User::sendMail().
-                       // @see https://phabricator.wikimedia.org/T70045
-                       global $wgPasswordSender;
-                       $sender = new MailAddress( $wgPasswordSender,
-                               wfMessage( 'emailsender' 
)->inContentLanguage()->text() );
-                       $to = new MailAddress( $user );
-                       UserMailer::send( $to, $sender, $subject, $body, array( 
'contentType' => 'text/html; charset=UTF-8' ) );
+                       $user->sendMail( $subject, $body );
                }
        }
 
diff --git a/UserBoard/i18n/en.json b/UserBoard/i18n/en.json
index e777b99..b04486b 100644
--- a/UserBoard/i18n/en.json
+++ b/UserBoard/i18n/en.json
@@ -55,5 +55,6 @@
        "userboard-time-minutes": "{{PLURAL:$1|one minute|$1 minutes}}",
        "userboard-time-seconds": "{{PLURAL:$1|one second|$1 seconds}}",
        "message_received_subject": "$1 wrote on your board on {{SITENAME}}",
+       "message_received_body_html": "Hi $1.\n\n$2 just wrote on your board on 
{{SITENAME}}!\n\nClick below to check out your 
board!\n\n[[Special:UserBoard]]\n\n---\n\nHey, want to stop getting e-mails 
from us?\n\nClick [[Special:UpdateProfile]]\nand change your settings to 
disable email notifications.",
        "message_received_body": "Hi $1.\n\n$2 just wrote on your board on 
{{SITENAME}}!\n\nClick below to check out your board!\n\n$3\n\n---\n\nHey, want 
to stop getting e-mails from us?\n\nClick $4\nand change your settings to 
disable email notifications."
 }
diff --git a/UserBoard/i18n/fi.json b/UserBoard/i18n/fi.json
index 70af3a5..a3c4a0b 100644
--- a/UserBoard/i18n/fi.json
+++ b/UserBoard/i18n/fi.json
@@ -56,5 +56,6 @@
        "userboard-time-minutes": "{{PLURAL:$1|minuutti|$1 minuuttia}}",
        "userboard-time-seconds": "{{PLURAL:$1|sekunti|$1 sekuntia}}",
        "message_received_subject": "$1 kirjoitti keskustelualueellesi 
{{GRAMMAR:inessive|{{SITENAME}}}}",
+       "message_received_body_html": "Hei $1:\n\n$2 juuri kirjoitti 
keskustelualueellesi {{GRAMMAR:inessive|{{SITENAME}}}}!\n\nNapsauta alapuolella 
olevaa linkki tarkistaaksesi 
keskustelualueesi!\n\n[[Special:UserBoard]]\n\n---\n\nHei, etkö halua enää 
saada sähköposteja meiltä?\n\nNapsauta [[Special:UpdateProfile]]\nja muuta 
asetuksiasi poistaaksesi sähköpostitoiminnot käytöstä.",
        "message_received_body": "Hei $1:\n\n$2 juuri kirjoitti 
keskustelualueellesi {{GRAMMAR:inessive|{{SITENAME}}}}!\n\nNapsauta alapuolella 
olevaa linkki tarkistaaksesi keskustelualueesi!\n\n$3\n\n---\n\nHei, etkö halua 
enää saada sähköposteja meiltä?\n\nNapsauta $4\nja muuta asetuksiasi 
poistaaksesi sähköpostitoiminnot käytöstä."
 }
diff --git a/UserGifts/UserGiftsClass.php b/UserGifts/UserGiftsClass.php
index 56744f6..b910b6d 100644
--- a/UserGifts/UserGiftsClass.php
+++ b/UserGifts/UserGiftsClass.php
@@ -87,22 +87,23 @@
                                $user_from,
                                $gift['gift_name']
                        )->parse();
-                       $body = wfMessage( 'gift_received_body',
-                               $name,
-                               $user_from,
-                               $gift['gift_name'],
-                               $giftsLink->getFullURL(),
-                               $updateProfileLink->getFullURL()
-                       )->parse();
 
-                       // The email contains HTML, so actually send it out as 
such, too.
-                       // That's why this no longer uses User::sendMail().
-                       // @see https://phabricator.wikimedia.org/T70045
-                       global $wgPasswordSender;
-                       $sender = new MailAddress( $wgPasswordSender,
-                               wfMessage( 'emailsender' 
)->inContentLanguage()->text() );
-                       $to = new MailAddress( $user );
-                       UserMailer::send( $to, $sender, $subject, $body, array( 
'contentType' => 'text/html; charset=UTF-8' ) );
+                       $body = array(
+                               'html' => wfMessage( 'gift_received_body_html',
+                                       $name,
+                                       $user_from,
+                                       $gift['gift_name']
+                               )->parse(),
+                               'text' => wfMessage( 'gift_received_body',
+                                       $name,
+                                       $user_from,
+                                       $gift['gift_name'],
+                                       $giftsLink->getFullURL(),
+                                       $updateProfileLink->getFullURL()
+                               )->text()
+                       );
+
+                       $user->sendMail( $subject, $body );
                }
        }
 
diff --git a/UserGifts/i18n/en.json b/UserGifts/i18n/en.json
index c4a676a..fc4ee85 100644
--- a/UserGifts/i18n/en.json
+++ b/UserGifts/i18n/en.json
@@ -79,6 +79,7 @@
        "g-viewgiftlist": "View gift list",
        "g-your-profile": "Your profile",
        "gift_received_subject": "$1 has sent you the $2 gift on {{SITENAME}}!",
+       "gift_received_body_html": "Hi $1.\n\n$2 just sent you the $3 gift on 
{{SITENAME}}.\n\nWant to read the note $2 left you and see your gift? Click the 
link below:\n\n[[Special:ViewGifts]]\n\nWe hope you like 
it!\n\nThanks,\n\n\nThe {{SITENAME}} team\n\n---\n\nHey, want to stop getting 
emails from us?\n\nClick [[Special:UpdateProfile]]\nand change your settings to 
disable email notifications.",
        "gift_received_body": "Hi $1.\n\n$2 just sent you the $3 gift on 
{{SITENAME}}.\n\nWant to read the note $2 left you and see your gift? Click the 
link below:\n\n$4\n\nWe hope you like it!\n\nThanks,\n\n\nThe {{SITENAME}} 
team\n\n---\n\nHey, want to stop getting emails from us?\n\nClick $5\nand 
change your settings to disable email notifications.",
        "right-giftadmin": "Create new and edit existing gifts"
 }
diff --git a/UserGifts/i18n/fi.json b/UserGifts/i18n/fi.json
index 21f8053..c6d2122 100644
--- a/UserGifts/i18n/fi.json
+++ b/UserGifts/i18n/fi.json
@@ -79,6 +79,7 @@
        "g-viewgiftlist": "Näytä lahjalista",
        "g-your-profile": "Profiilisi",
        "gift_received_subject": "$1 on lähettänyt sinulle lahjan $2 
{{GRAMMAR:inessive|{{SITENAME}}}}!",
-       "gift_received_body": "Hei $1:\n\n$2 juuri lähetti sinulle $3-lahjan 
{{GRAMMAR:inessive|{{SITENAME}}}}.\n\nHaluatko lukea viestin, jonka $2 jätti 
sinulle ja nähdä lahjasi?   Napsauta linkkiä alapuolella:\n\n$4\n\nToivomme, 
että pidät siitä!\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} 
tiimi\n\n---\n\nHei, etkö halua enää saada sähköposteja meiltä?\n\nNapsauta 
$5\nja muuta asetuksiasi poistaaksesi sähköpostitoiminnot käytöstä.",
+       "gift_received_body_html": "Hei $1:\n\n$2 juuri lähetti sinulle 
$3-lahjan {{GRAMMAR:inessive|{{SITENAME}}}}.\n\nHaluatko lukea viestin, jonka 
$2 jätti sinulle ja nähdä lahjasi? Napsauta linkkiä 
alapuolella:\n\n[[Special:ViewGifts]]\n\nToivomme, että pidät 
siitä!\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} tiimi\n\n---\n\nHei, 
etkö halua enää saada sähköposteja meiltä?\n\nNapsauta 
[[Special:UpdateProfile]]\nja muuta asetuksiasi poistaaksesi 
sähköpostitoiminnot käytöstä.",
+       "gift_received_body": "Hei $1:\n\n$2 juuri lähetti sinulle $3-lahjan 
{{GRAMMAR:inessive|{{SITENAME}}}}.\n\nHaluatko lukea viestin, jonka $2 jätti 
sinulle ja nähdä lahjasi? Napsauta linkkiä alapuolella:\n\n$4\n\nToivomme, että 
pidät siitä!\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} 
tiimi\n\n---\n\nHei, etkö halua enää saada sähköposteja meiltä?\n\nNapsauta 
$5\nja muuta asetuksiasi poistaaksesi sähköpostitoiminnot käytöstä.",
        "right-giftadmin": "Luoda uusia ja muokata olemassa olevia lahjoja"
 }
diff --git a/UserRelationship/UserRelationshipClass.php 
b/UserRelationship/UserRelationshipClass.php
index 2d05053..e47c44f 100644
--- a/UserRelationship/UserRelationshipClass.php
+++ b/UserRelationship/UserRelationshipClass.php
@@ -16,29 +16,6 @@
        }
 
        /**
-        * Quickie wrapper function for sending out an email as properly 
rendered
-        * HTML instead of plaintext.
-        *
-        * The functions in this class that call this function used to use
-        * User::sendMail(), but it was causing the mentioned bug, hence why 
this
-        * function had to be introduced.
-        *
-        * @see https://phabricator.wikimedia.org/T70045
-        *
-        * @param User $string User (object) whom to send an email
-        * @param string $subject Email subject
-        * @param $string $body Email contents (HTML)
-        * @return Status object
-        */
-       public function sendMail( $user, $subject, $body ) {
-               global $wgPasswordSender;
-               $sender = new MailAddress( $wgPasswordSender,
-                       wfMessage( 'emailsender' )->inContentLanguage()->text() 
);
-               $to = new MailAddress( $user );
-               return UserMailer::send( $to, $sender, $subject, $body, array( 
'contentType' => 'text/html; charset=UTF-8' ) );
-       }
-
-       /**
         * Add a relationship request to the database.
         *
         * @param $user_to String: user name of the recipient of the 
relationship
@@ -89,37 +66,48 @@
        public function sendRelationshipRequestEmail( $userIdTo, $userFrom, 
$type ) {
                $user = User::newFromId( $userIdTo );
                $user->loadFromDatabase();
+
                if ( $user->getEmail() && $user->getIntOption( 
'notifyfriendrequest', 1 ) ) {
                        $requestLink = SpecialPage::getTitleFor( 
'ViewRelationshipRequests' );
                        $updateProfileLink = SpecialPage::getTitleFor( 
'UpdateProfile' );
+
                        if ( trim( $user->getRealName() ) ) {
                                $name = $user->getRealName();
                        } else {
                                $name = $user->getName();
                        }
+
                        if ( $type == 1 ) {
-                               $subject = wfMessage( 'friend_request_subject',
-                                       $userFrom
-                               )->text();
-                               $body = wfMessage( 'friend_request_body',
-                                       $name,
-                                       $userFrom,
-                                       $requestLink->getFullURL(),
-                                       $updateProfileLink->getFullURL()
-                               )->text();
+                               $subject = wfMessage( 'friend_request_subject', 
$userFrom )->text();
+                               $body = array(
+                                       'html' => wfMessage( 
'friend_request_body_html',
+                                               $name,
+                                               $userFrom
+                                       )->parse(),
+                                       'text' => wfMessage( 
'friend_request_body',
+                                               $name,
+                                               $userFrom,
+                                               $requestLink->getFullURL(),
+                                               $updateProfileLink->getFullURL()
+                                       )->text()
+                               );
                        } else {
-                               $subject = wfMessage( 'foe_request_subject',
-                                       $userFrom
-                               )->text();
-                               $body = wfMessage( 'foe_request_body',
-                                       $name,
-                                       $userFrom,
-                                       $requestLink->getFullURL(),
-                                       $updateProfileLink->getFullURL()
-                               )->text();
+                               $subject = wfMessage( 'foe_request_subject', 
$userFrom )->text();
+                               $body = array(
+                                       'html' => wfMessage( 
'foe_request_body_html',
+                                               $name,
+                                               $userFrom
+                                       )->parse(),
+                                       'text' => wfMessage( 'foe_request_body',
+                                               $name,
+                                               $userFrom,
+                                               $requestLink->getFullURL(),
+                                               $updateProfileLink->getFullURL()
+                                       )->text()
+                               );
                        }
 
-                       $this->sendMail( $user, $subject, $body );
+                       $user->sendMail( $subject, $body );
                }
        }
 
@@ -134,36 +122,48 @@
        public function sendRelationshipAcceptEmail( $userIdTo, $userFrom, 
$type ) {
                $user = User::newFromId( $userIdTo );
                $user->loadFromDatabase();
+
                if ( $user->getEmail() && $user->getIntOption( 
'notifyfriendrequest', 1 ) ) {
                        $userLink = Title::makeTitle( NS_USER, $userFrom );
                        $updateProfileLink = SpecialPage::getTitleFor( 
'UpdateProfile' );
+
                        if ( trim( $user->getRealName() ) ) {
                                $name = $user->getRealName();
                        } else {
                                $name = $user->getName();
                        }
+
                        if ( $type == 1 ) {
-                               $subject = wfMessage( 'friend_accept_subject',
-                                       $userFrom
-                               )->text();
-                               $body = wfMessage( 'friend_accept_body',
-                                       $name,
-                                       $userFrom,
-                                       $userLink->getFullURL(),
-                                       $updateProfileLink->getFullURL()
-                               )->text();
+                               $subject = wfMessage( 'friend_accept_subject', 
$userFrom )->text();
+                               $body = array(
+                                       'html' => wfMessage( 
'friend_accept_body_html',
+                                               $name,
+                                               $userFrom
+                                       )->parse(),
+                                       'text' => wfMessage( 
'friend_accept_body',
+                                               $name,
+                                               $userFrom,
+                                               $userLink->getFullURL(),
+                                               $updateProfileLink->getFullURL()
+                                       )->text()
+                               );
                        } else {
-                               $subject = wfMessage( 'foe_accept_subject',
-                                       $userFrom
-                               )->text();
-                               $body = wfMessage( 'foe_accept_body',
-                                       $name,
-                                       $userFrom,
-                                       $userLink->getFullURL(),
-                                       $updateProfileLink->getFullURL()
-                               )->text();
+                               $subject = wfMessage( 'foe_accept_subject', 
$userFrom )->text();
+                               $body = array(
+                                       'html' => wfMessage( 
'foe_accept_body_html',
+                                               $name,
+                                               $userFrom
+                                       )->parse(),
+                                       'text' => wfMessage( 'foe_accept_body',
+                                               $name,
+                                               $userFrom,
+                                               $userLink->getFullURL(),
+                                               $updateProfileLink->getFullURL()
+                                       )->text()
+                               );
                        }
-                       $this->sendMail( $user, $subject, $body );
+
+                       $user->sendMail( $subject, $body );
                }
        }
 
@@ -178,36 +178,48 @@
        public function sendRelationshipRemoveEmail( $userIdTo, $userFrom, 
$type ) {
                $user = User::newFromId( $userIdTo );
                $user->loadFromDatabase();
+
                if ( $user->isEmailConfirmed() && $user->getIntOption( 
'notifyfriendrequest', 1 ) ) {
                        $userLink = Title::makeTitle( NS_USER, $userFrom );
                        $updateProfileLink = SpecialPage::getTitleFor( 
'UpdateProfile' );
+
                        if ( trim( $user->getRealName() ) ) {
                                $name = $user->getRealName();
                        } else {
                                $name = $user->getName();
                        }
+
                        if ( $type == 1 ) {
-                               $subject = wfMessage( 'friend_removed_subject',
-                                       $userFrom
-                               )->text();
-                               $body = wfMessage( 'friend_removed_body',
-                                       $name,
-                                       $userFrom,
-                                       $userLink->getFullURL(),
-                                       $updateProfileLink->getFullURL()
-                               )->text();
+                               $subject = wfMessage( 'friend_removed_subject', 
$userFrom )->text();
+                               $body = array(
+                                       'html' => wfMessage( 
'friend_removed_body_html',
+                                               $name,
+                                               $userFrom
+                                       )->parse(),
+                                       'text' => wfMessage( 
'friend_removed_body',
+                                               $name,
+                                               $userFrom,
+                                               $userLink->getFullURL(),
+                                               $updateProfileLink->getFullURL()
+                                       )->text()
+                               );
                        } else {
-                               $subject = wfMessage( 'foe_removed_subject',
-                                       $userFrom
-                               )->text();
-                               $body = wfMessage( 'foe_removed_body',
-                                       $name,
-                                       $userFrom,
-                                       $userLink->getFullURL(),
-                                       $updateProfileLink->getFullURL()
-                               )->text();
+                               $subject = wfMessage( 'foe_removed_subject', 
$userFrom )->text();
+                               $body = array(
+                                       'html' => wfMessage( 
'foe_removed_body_html',
+                                               $name,
+                                               $userFrom
+                                       )->parse(),
+                                       'text' => wfMessage( 'foe_removed_body',
+                                               $name,
+                                               $userFrom,
+                                               $userLink->getFullURL(),
+                                               $updateProfileLink->getFullURL()
+                                       )->text()
+                               );
                        }
-                       $this->sendMail( $user, $subject, $body );
+
+                       $user->sendMail( $subject, $body );
                }
        }
 
diff --git a/UserRelationship/i18n/en.json b/UserRelationship/i18n/en.json
index d7b95c7..ae28825 100644
--- a/UserRelationship/i18n/en.json
+++ b/UserRelationship/i18n/en.json
@@ -74,15 +74,21 @@
        "ur-title-foe": "$1's foe list",
        "ur-title-friend": "$1's friend list",
        "friend_request_subject": "$1 has added you as a friend on 
{{SITENAME}}!",
+       "friend_request_body_html": "Hi $1.\n\n$2 has added you as a friend on 
{{SITENAME}}. We want to make sure that you two are actually friends.\n\nPlease 
click this link to confirm your 
friendship:\n[[Special:ViewRelationshipRequests]]\n\nThanks,\n\n\nThe 
{{SITENAME}} team\n\n---\n\nHey, want to stop getting e-mails from us?\n\nClick 
[[Special:UpdateProfile]]\nand change your settings to disable e-mail 
notifications.",
        "friend_request_body": "Hi $1.\n\n$2 has added you as a friend on 
{{SITENAME}}. We want to make sure that you two are actually friends.\n\nPlease 
click this link to confirm your friendship:\n$3\n\nThanks,\n\n\nThe 
{{SITENAME}} team\n\n---\n\nHey, want to stop getting e-mails from us?\n\nClick 
$4\nand change your settings to disable e-mail notifications.",
        "foe_request_subject": "It's war! $1 has added you to as a foe on 
{{SITENAME}}!",
+       "foe_request_body_html": "Hi $1.\n\n$2 just listed you as a foe on 
{{SITENAME}}. We want to make sure that you two are actually mortal enemies or 
at least having an argument.\n\nPlease click this link to confirm the grudge 
match.\n\n[[Special:ViewRelationshipRequests]]\n\nThanks,\n\n\nThe {{SITENAME}} 
team\n\n---\n\nHey, want to stop getting e-mails from us?\n\nClick 
[[Special:UpdateProfile]]\nand change your settings to disable e-mail 
notifications.",
        "foe_request_body": "Hi $1.\n\n$2 just listed you as a foe on 
{{SITENAME}}. We want to make sure that you two are actually mortal enemies or 
at least having an argument.\n\nPlease click this link to confirm the grudge 
match.\n\n$3\n\nThanks,\n\n\nThe {{SITENAME}} team\n\n---\n\nHey, want to stop 
getting e-mails from us?\n\nClick $4\nand change your settings to disable 
e-mail notifications.",
        "friend_accept_subject": "$1 has accepted your friend request on 
{{SITENAME}}!",
+       "friend_accept_body_html": "Hi $1.\n\n$2 has accepted your friend 
request on {{SITENAME}}!\n\nCheck out $2's page at 
[[User:$2]]\n\nThanks,\n\n\nThe {{SITENAME}} team\n\n---\n\nHey, want to stop 
getting e-mails from us?\n\nClick [[Special:UpdateProfile]]\nand change your 
settings to disable e-mail notifications.",
        "friend_accept_body": "Hi $1.\n\n$2 has accepted your friend request on 
{{SITENAME}}!\n\nCheck out $2's page at $3\n\nThanks,\n\n\nThe {{SITENAME}} 
team\n\n---\n\nHey, want to stop getting e-mails from us?\n\nClick $4\nand 
change your settings to disable e-mail notifications.",
        "foe_accept_subject": "It's on! $1 has accepted your foe request on 
{{SITENAME}}!",
+       "foe_accept_body_html": "Hi $1.\n\n$2 has accepted your foe request on 
{{SITENAME}}!\n\nCheck out $2's page at [[User:$2]]\n\nThanks,\n\n\nThe 
{{SITENAME}} team\n\n---\n\nHey, want to stop getting e-mails from us?\n\nClick 
[[Special:UpdateProfile]]\nand change your settings to disable e-mail 
notifications.",
        "foe_accept_body": "Hi $1.\n\n$2 has accepted your foe request on 
{{SITENAME}}!\n\nCheck out $2's page at $3\n\nThanks,\n\n\nThe {{SITENAME}} 
team\n\n---\n\nHey, want to stop getting e-mails from us?\n\nClick $4\nand 
change your settings to disable e-mail notifications.",
        "friend_removed_subject": "Oh no! $1 has removed you as a friend on 
{{SITENAME}}!",
+       "friend_removed_body_html": "Hi $1.\n\n$2 has removed you as a friend 
on {{SITENAME}}!\n\nThanks,\n\n\nThe {{SITENAME}} team\n\n---\n\nHey, want to 
stop getting e-mails from us?\n\nClick [[Special:UpdateProfile]]\nand change 
your settings to disable e-mail notifications.",
        "friend_removed_body": "Hi $1.\n\n$2 has removed you as a friend on 
{{SITENAME}}!\n\nThanks,\n\n\nThe {{SITENAME}} team\n\n---\n\nHey, want to stop 
getting e-mails from us?\n\nClick $4\nand change your settings to disable 
e-mail notifications.",
        "foe_removed_subject": "Woohoo! $1 has removed you as a foe on 
{{SITENAME}}!",
+       "foe_removed_body_html": "Hi $1.\n\n\t$2 has removed you as a foe on 
{{SITENAME}}!\n\nPerhaps you two are on your way to becoming 
friends?\n\nThanks,\n\n\nThe {{SITENAME}} team\n\n---\n\nHey, want to stop 
getting e-mails from us?\n\nClick [[Special:UpdateProfile]]\nand change your 
settings to disable e-mail notifications.",
        "foe_removed_body": "Hi $1.\n\n\t$2 has removed you as a foe on 
{{SITENAME}}!\n\nPerhaps you two are on your way to becoming 
friends?\n\nThanks,\n\n\nThe {{SITENAME}} team\n\n---\n\nHey, want to stop 
getting e-mails from us?\n\nClick $4\nand change your settings to disable 
e-mail notifications."
 }
diff --git a/UserRelationship/i18n/fi.json b/UserRelationship/i18n/fi.json
index a4fb856..b6708fa 100644
--- a/UserRelationship/i18n/fi.json
+++ b/UserRelationship/i18n/fi.json
@@ -74,15 +74,21 @@
        "ur-title-foe": "Käyttäjän $1 vihollislista",
        "ur-title-friend": "Käyttäjän $1 ystävälista",
        "friend_request_subject": "$1 on lisännyt sinut ystäväksesi 
{{GRAMMAR:inessive|{{SITENAME}}}}!",
-       "friend_request_body": "Hei $1:\n\n$2 on lisännyt sinut ystäväksesi 
{{GRAMMAR:inessive|{{SITENAME}}}}.  Haluamme varmistua siitä, että te olette 
oikeasti ystäviä.\n\nNapsauta allaolevaa linkkiä vahvistaaksesi 
ystävyytenne:\n$3\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} 
tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta 
$4\nja muuta asetuksiasi poistaaksesi sähköposti-ilmoitukset käytöstä.",
+       "friend_request_body_html": "Hei $1:\n\n$2 on lisännyt sinut 
ystäväksesi {{GRAMMAR:inessive|{{SITENAME}}}}. Haluamme varmistua siitä, että 
te olette oikeasti ystäviä.\n\nNapsauta allaolevaa linkkiä vahvistaaksesi 
ystävyytenne:\n[[Special:ViewRelationshipRequests]]\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}}
 tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta 
[[Special:UpdateProfile]]\nja muuta asetuksiasi poistaaksesi 
sähköposti-ilmoitukset käytöstä.",
+       "friend_request_body": "Hei $1:\n\n$2 on lisännyt sinut ystäväksesi 
{{GRAMMAR:inessive|{{SITENAME}}}}. Haluamme varmistua siitä, että te olette 
oikeasti ystäviä.\n\nNapsauta allaolevaa linkkiä vahvistaaksesi 
ystävyytenne:\n$3\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} 
tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta 
$4\nja muuta asetuksiasi poistaaksesi sähköposti-ilmoitukset käytöstä.",
        "foe_request_subject": "Sotaa! $1 on lisännyt sinut vihollisekseen 
{{GRAMMAR:inessive|{{SITENAME}}}}!",
-       "foe_request_body": "Hei $1:\n\n$2 juuri listasi sinut vihollisekseen 
{{GRAMMAR:inessive|{{SITENAME}}}}.  Haluamme varmistua siitä, että te olette 
oikeasti perivihollisia tai että teillä ainakin on pientä kinaa.\n\nNapsauta 
allaolevaa linkkiä vahvistaaksesi 
kaunanne.\n\n$3\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} 
tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta $4 
ja muuta asetuksiasi poistaaksesi sähköposti-ilmoitukset käytöstä.",
+       "foe_request_body_html": "Hei $1:\n\n$2 juuri listasi sinut 
vihollisekseen {{GRAMMAR:inessive|{{SITENAME}}}}. Haluamme varmistua siitä, 
että te olette oikeasti perivihollisia tai että teillä ainakin on pientä 
kinaa.\n\nNapsauta allaolevaa linkkiä vahvistaaksesi 
kaunanne.\n\n[[Special:ViewRelationshipRequests]]\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}}
 tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta 
[[Special:UpdateProfile]] ja muuta asetuksiasi poistaaksesi 
sähköposti-ilmoitukset käytöstä.",
+       "foe_request_body": "Hei $1:\n\n$2 juuri listasi sinut vihollisekseen 
{{GRAMMAR:inessive|{{SITENAME}}}}. Haluamme varmistua siitä, että te olette 
oikeasti perivihollisia tai että teillä ainakin on pientä kinaa.\n\nNapsauta 
allaolevaa linkkiä vahvistaaksesi 
kaunanne.\n\n$3\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} 
tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta $4 
ja muuta asetuksiasi poistaaksesi sähköposti-ilmoitukset käytöstä.",
        "friend_accept_subject": "$1 on hyväksynyt ystävyyspyyntösi 
{{GRAMMAR:inessive|{{SITENAME}}}}!",
+       "friend_accept_body_html": "Hei $1:\n\n$2 on hyväksynyt 
ystävyyspyyntösi {{GRAMMAR:inessive|{{SITENAME}}}}!\n\nKatso $2:n sivu 
osoitteessa [[User:$2]]\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} 
tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta 
[[Special:UpdateProfile]]\nja muuta asetuksiasi poistaaksesi 
sähköposti-ilmoitukset käytöstä.",
        "friend_accept_body": "Hei $1:\n\n$2 on hyväksynyt ystävyyspyyntösi 
{{GRAMMAR:inessive|{{SITENAME}}}}!\n\nKatso $2:n sivu osoitteessa 
$3\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} tiimi\n\n---\n\nHei, 
etkö enää halua saada sähköpostia meiltä?\n\nNapsauta $4\nja muuta asetuksiasi 
poistaaksesi sähköposti-ilmoitukset käytöstä.",
        "foe_accept_subject": "Sotaa! $1 on hyväksynyt vihollisuuspyyntösi 
{{GRAMMAR:inessive|{{SITENAME}}}}!",
+       "foe_accept_body_html": "Hei $1:\n\n$2 on hyväksynyt 
vihollisuuspyyntösi {{GRAMMAR:inessive|{{SITENAME}}}}!\n\nKatso $2:n sivu 
osoitteessa [[User:$2]]\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} 
tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta 
[[Special:UpdateProfile]]\nja muuta asetuksiasi poistaaksesi 
sähköposti-ilmoitukset käytöstä.",
        "foe_accept_body": "Hei $1:\n\n$2 on hyväksynyt vihollisuuspyyntösi 
{{GRAMMAR:inessive|{{SITENAME}}}}!\n\nKatso $2:n sivu osoitteessa 
$3\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} tiimi\n\n---\n\nHei, 
etkö enää halua saada sähköpostia meiltä?\n\nNapsauta $4\nja muuta asetuksiasi 
poistaaksesi sähköposti-ilmoitukset käytöstä.",
        "friend_removed_subject": "Voi ei! $1 on poistanut sinut 
ystävälistaltaan {{GRAMMAR:inessive|{{SITENAME}}}}!",
+       "friend_removed_body_html": "Hei $1:\n\n$2 on poistanut sinut 
ystävälistaltaan 
{{GRAMMAR:inessive|{{SITENAME}}}}!\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}}
 tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta 
[[Special:UpdateProfile]]\nja muuta asetuksiasi poistaaksesi 
sähköposti-ilmoitukset käytöstä.",
        "friend_removed_body": "Hei $1:\n\n$2 on poistanut sinut 
ystävälistaltaan 
{{GRAMMAR:inessive|{{SITENAME}}}}!\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}}
 tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta 
$4\nja muuta asetuksiasi poistaaksesi sähköposti-ilmoitukset käytöstä.",
        "foe_removed_subject": "Jippii! $1 on poistanut sinut 
vihollislistaltaan {{GRAMMAR:inessive|{{SITENAME}}}}!",
+       "foe_removed_body_html": "Hei $1:\n\n$2 on poistanut sinut 
vihollislistaltaan {{GRAMMAR:inessive|{{SITENAME}}}}!\n\nEhkäpä teistä tulee 
vielä ystävät?\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} 
tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta 
[[Special:UpdateProfile]]\nja muuta asetuksiasi poistaaksesi 
sähköposti-ilmoitukset käytöstä.",
        "foe_removed_body": "Hei $1:\n\n$2 on poistanut sinut 
vihollislistaltaan {{GRAMMAR:inessive|{{SITENAME}}}}!\n\nEhkäpä teistä tulee 
vielä ystävät?\n\nKiittäen,\n\n\n{{GRAMMAR:genitive|{{SITENAME}}}} 
tiimi\n\n---\n\nHei, etkö enää halua saada sähköpostia meiltä?\n\nNapsauta 
$4\nja muuta asetuksiasi poistaaksesi sähköposti-ilmoitukset käytöstä."
 }
diff --git a/UserStats/i18n/en.json b/UserStats/i18n/en.json
index 962afe0..44c0ee5 100644
--- a/UserStats/i18n/en.json
+++ b/UserStats/i18n/en.json
@@ -51,6 +51,7 @@
        "right-generatetopusersreport": "Generate top users reports",
        "level-advanced-to": "advanced to level <span 
style=\"font-weight:800;\">$1</span>",
        "level-advance-subject": "You are now a \"$1\" on {{SITENAME}}!",
+       "level-advance-body-html": "Hi $1.\n\nYou are now a \"$2\" on 
{{SITENAME}}!\n\nCongratulations,\n\nThe {{SITENAME}} team\n\n---\nHey, want to 
stop getting e-mails from us?\n\nClick [[Special:UpdateProfile]]\nand change 
your settings to disable e-mail notifications.",
        "level-advance-body": "Hi $1.\n\nYou are now a \"$2\" on 
{{SITENAME}}!\n\nCongratulations,\n\nThe {{SITENAME}} team\n\n---\nHey, want to 
stop getting e-mails from us?\n\nClick $3\nand change your settings to disable 
e-mail notifications.",
        "updateeditcounts": "Update Edit Counts",
        "updateeditcounts-updated": "Updated stats for '''$1''' 
{{PLURAL:$1|user|users}}",
diff --git a/UserStats/i18n/fi.json b/UserStats/i18n/fi.json
index 04f246c..dc36d69 100644
--- a/UserStats/i18n/fi.json
+++ b/UserStats/i18n/fi.json
@@ -53,6 +53,7 @@
        "right-generatetopusersreport": "Luoda huippukäyttäjäraportteja",
        "level-advanced-to": "pääsi tasolle <span 
style=\"font-weight:800;\">$1</span>",
        "level-advance-subject": "Olet nyt \"$1\" 
{{GRAMMAR:inessive|{{SITENAME}}}}!",
+       "level-advance-body-html": "Hei $1:\n\nOlet nyt \"$2\" 
{{GRAMMAR:inessive|{{SITENAME}}}}!\n\nOnneksi 
olkoon,\n\n{{GRAMMAR:genitive|{{SITENAME}}}} tiimi\n\n---\nHei, etkö enää halua 
saada sähköpostia meiltä?\n\nNapsauta [[Special:UpdateProfile]]\nja muuta 
asetuksiasi poistaaksesi sähköposti-ilmoitukset käytöstä.",
        "level-advance-body": "Hei $1:\n\nOlet nyt \"$2\" 
{{GRAMMAR:inessive|{{SITENAME}}}}!\n\nOnneksi 
olkoon,\n\n{{GRAMMAR:genitive|{{SITENAME}}}} tiimi\n\n---\nHei, etkö enää halua 
saada sähköpostia meiltä?\n\nNapsauta $3\nja muuta asetuksiasi poistaaksesi 
sähköposti-ilmoitukset käytöstä.",
        "generatetopusersreport": "Luo raportti huippukäyttäjistä",
        "user-stats-weekly-winners": "Viikon {{PLURAL:$1|voittaja|voittajat}}",
diff --git a/UserSystemMessages/UserSystemMessagesClass.php 
b/UserSystemMessages/UserSystemMessagesClass.php
index 333e7a2..7cb88b8 100644
--- a/UserSystemMessages/UserSystemMessagesClass.php
+++ b/UserSystemMessages/UserSystemMessagesClass.php
@@ -116,20 +116,16 @@
                        } else {
                                $name = $user->getName();
                        }
-                       $body = wfMessage( 'level-advance-body',
-                               $name,
-                               $level,
-                               $updateProfileLink->getFullURL()
-                       )->text();
+                       $body = array(
+                               'html' => wfMessage( 'level-advance-body-html', 
$name, $level )->parse(),
+                               'text' => wfMessage( 'level-advance-body',
+                                       $name,
+                                       $level,
+                                       $updateProfileLink->getFullURL()
+                               )->text()
+                       );
 
-                       // The email contains HTML, so actually send it out as 
such, too.
-                       // That's why this no longer uses User::sendMail().
-                       // @see https://phabricator.wikimedia.org/T70045
-                       global $wgPasswordSender;
-                       $sender = new MailAddress( $wgPasswordSender,
-                               wfMessage( 'emailsender' 
)->inContentLanguage()->text() );
-                       $to = new MailAddress( $user );
-                       UserMailer::send( $to, $sender, $subject, $body, array( 
'contentType' => 'text/html; charset=UTF-8' ) );
+                       $user->sendMail( $subject, $body );
                }
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia66c90fef70e9199fd8625b1b38dcde13b3ff6a3
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/SocialProfile
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Lewis Cawte <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to