diff --git a/extension.json b/extension.json index a011d56..2813c38 100644 --- a/extension.json +++ b/extension.json @@ -34,6 +34,7 @@ "NameReadonly": false, "EmailReadonly": false, "SubjectReadonly": false, + "UseCustomBlockMessage": false, "RLModules": [], "RLStyleModules": [], "AdditionalFields": { diff --git a/includes/SpecialContact.php b/includes/SpecialContact.php index fe53532..8268103 100644 --- a/includes/SpecialContact.php +++ b/includes/SpecialContact.php @@ -158,9 +158,16 @@ class SpecialContact extends UnlistedSpecialPage { // Blocked users cannot use the contact form if they're disabled from sending email. if ( $user->isBlockedFromEmailuser() ) { - // If the user is blocked from emailing users then there is a block - // @phan-suppress-next-line PhanTypeMismatchArgumentNullable - throw new UserBlockedError( $this->getUser()->getBlock() ); + $useCustomBlockMessage = $config['UseCustomBlockMessage'] ?? false; + if ( $useCustomBlockMessage ) { + $this->getOutput()->showErrorPage( $this->getFormSpecificMessageKey( 'contactpage-title' ), + $this->getFormSpecificMessageKey( 'contactpage-blocked-message' ) ); + return; + } else { + // If the user is blocked from emailing users then there is a block + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable + throw new UserBlockedError( $this->getUser()->getBlock() ); + } } $this->getOutput()->setPageTitleMsg(