Merge "SpecialUnusedimages: Change message when CountCategorizedImagesAsUsed"
[lhc/web/wiklou.git] / includes / specials / SpecialEmailuser.php
index b5fa85b..aebec2f 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':
@@ -519,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 );
+       }
 }