From: Kunal Mehta Date: Sun, 23 Jul 2017 22:21:12 +0000 (-0700) Subject: [SECURITY] Restore ability to suppress pages while deleting X-Git-Tag: 1.31.0-rc.0~2627 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=50ea235528289fa3b7b31a2281c6c7683053b7f4 [SECURITY] Restore ability to suppress pages while deleting The OOUI refactor in 97a8fb78fa lost the ability to suppress pages while deleting. This converts the suppress checkbox into a OOUI one, and then modifies the detection of whether the checkbox was used to use WebRequest::getCheck(). Bug: T171405 Change-Id: I8c388808c08b8804689b41876fd2bcdeff7f0e70 --- diff --git a/includes/page/Article.php b/includes/page/Article.php index d13fb3c11e..28db73c35f 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -1594,7 +1594,7 @@ class Article implements Page { [ 'delete', $this->getTitle()->getPrefixedText() ] ) ) { # Flag to hide all contents of the archived revisions - $suppress = $request->getVal( 'wpSuppress' ) && $user->isAllowed( 'suppressrevision' ); + $suppress = $request->getCheck( 'wpSuppress' ) && $user->isAllowed( 'suppressrevision' ); $this->doDelete( $reason, $suppress ); @@ -1692,14 +1692,6 @@ class Article implements Page { Hooks::run( 'ArticleConfirmDelete', [ $this, $outputPage, &$reason ] ); $user = $this->getContext()->getUser(); - if ( $user->isAllowed( 'suppressrevision' ) ) { - $suppress = Html::openElement( 'div', [ 'id' => 'wpDeleteSuppressRow' ] ) . - Xml::checkLabel( wfMessage( 'revdelete-suppress' )->text(), - 'wpSuppress', 'wpSuppress', false, [ 'tabindex' => '4' ] ) . - Html::closeElement( 'div' ); - } else { - $suppress = ''; - } $checkWatch = $user->getBoolOption( 'watchdeletion' ) || $user->isWatched( $title ); $outputPage->enableOOUI(); @@ -1770,6 +1762,21 @@ class Article implements Page { ); } + if ( $user->isAllowed( 'suppressrevision' ) ) { + $fields[] = new OOUI\FieldLayout( + new OOUI\CheckboxInputWidget( [ + 'name' => 'wpSuppress', + 'inputId' => 'wpSuppress', + 'tabIndex' => 4, + ] ), + [ + 'label' => $ctx->msg( 'revdelete-suppress' )->text(), + 'align' => 'inline', + 'infusable' => true, + ] + ); + } + $fields[] = new OOUI\FieldLayout( new OOUI\ButtonInputWidget( [ 'name' => 'wpConfirmB',