Merge "Add support for Argon2 password hashing"
[lhc/web/wiklou.git] / includes / specials / SpecialEmailuser.php
index 342f6db..10a9e96 100644 (file)
@@ -134,7 +134,7 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                        case 'badaccess':
                                throw new PermissionsError( 'sendemail' );
                        case 'blockedemailuser':
-                               throw new UserBlockedError( $this->getUser()->mBlock );
+                               throw $this->getBlockedEmailError();
                        case 'actionthrottledtext':
                                throw new ThrottledError;
                        case 'mailnologin':
@@ -156,7 +156,7 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                // if the user opens Special:EmailUser/Florian (e.g.). So check, if the user did that
                // and show the "Send email to user" form directly, if so. Show the "enter username"
                // form, otherwise.
-               $this->mTargetObj = self::getTarget( $this->mTarget );
+               $this->mTargetObj = self::getTarget( $this->mTarget, $this->getUser() );
                if ( !$this->mTargetObj instanceof User ) {
                        $this->userForm( $this->mTarget );
                } else {
@@ -318,7 +318,6 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                        ->setMethod( 'post' )
                        ->setSubmitCallback( [ $this, 'sendEmailForm' ] )
                        ->setFormIdentifier( 'userForm' )
-                       ->setSubmitProgressive()
                        ->setId( 'askusername' )
                        ->setWrapperLegendMsg( 'emailtarget' )
                        ->setSubmitTextMsg( 'emailusernamesubmit' )
@@ -469,7 +468,7 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                        if ( $data['CCMe'] && $to != $from ) {
                                $ccTo = $from;
                                $ccFrom = $from;
-                               $ccSubject = $context->msg( 'emailccsubject' )->rawParams(
+                               $ccSubject = $context->msg( 'emailccsubject' )->plaintextParams(
                                        $target->getName(), $subject )->text();
                                $ccText = $text;
 
@@ -520,4 +519,17 @@ class SpecialEmailUser extends UnlistedSpecialPage {
        protected function getGroupName() {
                return 'users';
        }
+
+       /**
+        * Builds an error message based on the block params
+        *
+        * @return ErrorPageError
+        */
+       private function getBlockedEmailError() {
+               $block = $this->getUser()->mBlock;
+               $params = $block->getBlockErrorParams( $this->getContext() );
+
+               $msg = $block->isSitewide() ? 'blockedtext' : 'blocked-email-user';
+               return new ErrorPageError( 'blockedtitle', $msg, $params );
+       }
 }