Page MenuHomePhabricator

0001-SECURITY-Restore-ability-to-suppress-pages-while-del.patch

Authored By
Legoktm
Jul 23 2017, 10:52 PM
Size
2 KB
Referenced Files
None
Subscribers
None

0001-SECURITY-Restore-ability-to-suppress-pages-while-del.patch

From 50ea235528289fa3b7b31a2281c6c7683053b7f4 Mon Sep 17 00:00:00 2001
From: Kunal Mehta <legoktm@member.fsf.org>
Date: Sun, 23 Jul 2017 15:21:12 -0700
Subject: [PATCH] [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
---
includes/page/Article.php | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
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',
--
2.13.3

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4794232
Default Alt Text
0001-SECURITY-Restore-ability-to-suppress-pages-while-del.patch (2 KB)

Event Timeline