case 'badaccess':
throw new PermissionsError( 'sendemail' );
case 'blockedemailuser':
- throw new UserBlockedError( $this->getUser()->mBlock );
+ throw $this->getBlockedEmailError();
case 'actionthrottledtext':
throw new ThrottledError;
case 'mailnologin':
// 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 {
->setMethod( 'post' )
->setSubmitCallback( [ $this, 'sendEmailForm' ] )
->setFormIdentifier( 'userForm' )
- ->setSubmitProgressive()
->setId( 'askusername' )
->setWrapperLegendMsg( 'emailtarget' )
->setSubmitTextMsg( 'emailusernamesubmit' )
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;
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 );
+ }
}