Add optional parameter to show message if user is blocked.

If a user or IP address is blocked from sending emails, they will not be
able to access the Contact form. For our purposes of account vanishing,
this is problematic because the user will not see any further
instructions on how to proceed with account vanishing, and would instead
see instructions for appealing the block.

This patch provides a simple mechanism for showing a message if the
account or IP is blocked (instead of the default block template), which
may contain other instructions for the user in specific cases like ours.

Bug: T343536
Change-Id: I77b4b049b07f9f1e729a9a0ca6b63a6d15343848
这个提交包含在:
Dmitry Brant 2024-03-19 10:22:07 -04:00
父节点 561aadc974
当前提交 56e540c606
共有 2 个文件被更改,包括 11 次插入3 次删除

查看文件

@ -34,6 +34,7 @@
"NameReadonly": false,
"EmailReadonly": false,
"SubjectReadonly": false,
"UseCustomBlockMessage": false,
"RLModules": [],
"RLStyleModules": [],
"AdditionalFields": {

查看文件

@ -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(