From: Thalia Date: Mon, 14 Jan 2019 14:58:42 +0000 (+0000) Subject: Fix non-editing partial block creation on Special:Block X-Git-Tag: 1.34.0-rc.0~3080^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/One?a=commitdiff_plain;h=043a9087464a4f1e3346a317342111e56a23f5f3;p=lhc%2Fweb%2Fwiklou.git Fix non-editing partial block creation on Special:Block Bug: T213707 Change-Id: Iaf8b3a6a0b2715808c9e6f8de94d315404368b12 --- diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index 47d61b82a0..e47ef0619c 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -399,6 +399,10 @@ class SpecialBlock extends FormSpecialPage { $pageRestrictions[] = $restriction->getTitle()->getPrefixedText(); } + if ( !$block->isSitewide() && empty( $pageRestrictions ) ) { + $fields['Editing']['default'] = false; + } + // Sort the restrictions so they are in alphabetical order. sort( $pageRestrictions ); $fields['PageRestrictions']['default'] = implode( "\n", $pageRestrictions ); @@ -1158,6 +1162,12 @@ class SpecialBlock extends FormSpecialPage { * @return bool|array True for success, false for didn't-try, array of errors on failure */ public function onSubmit( array $data, HTMLForm $form = null ) { + // If "Editing" checkbox is unchecked, the block must be a partial block affecting + // actions other than editing, and there must be no restrictions. + if ( isset( $data['Editing'] ) && $data['Editing'] === false ) { + $data['EditingRestriction'] = 'partial'; + $data['PageRestrictions'] = []; + } return self::processForm( $data, $form->getContext() ); }