From b5a79ed84ce50e41ccfb9478d470b3c5e4d67f72 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Sat, 13 Oct 2012 15:05:00 +0100 Subject: [PATCH] (bug 23721) Only show deletedOnly checkbox on contribs and history if the user can see deleted entries Change-Id: Id47f2883e22a8742d4e5c322c349743e9101f4a3 --- includes/actions/HistoryAction.php | 6 +++++- includes/specials/SpecialContributions.php | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index a2d49e679c..61de3b6328 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -158,8 +158,12 @@ class HistoryAction extends FormlessAction { } else { $conds = array(); } - $checkDeleted = Xml::checkLabel( $this->msg( 'history-show-deleted' )->text(), + if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) { + $checkDeleted = Xml::checkLabel( $this->msg( 'history-show-deleted' )->text(), 'deleted', 'mw-show-deleted-only', $request->getBool( 'deleted' ) ) . "\n"; + } else { + $checkDeleted = ''; + } // Add the general form $action = htmlspecialchars( $wgScript ); diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 54f8e26166..ca8c9c8eb4 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -485,8 +485,8 @@ class SpecialContributions extends SpecialPage { ) ) ; - $extraOptions = Xml::tags( 'td', array( 'colspan' => 2 ), - Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ), + if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) { + $deletedOnlyCheck = Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ), Xml::checkLabel( $this->msg( 'history-show-deleted' )->text(), 'deletedOnly', @@ -494,7 +494,13 @@ class SpecialContributions extends SpecialPage { $this->opts['deletedOnly'], array( 'class' => 'mw-input' ) ) - ) . + ); + } else { + $deletedOnlyCheck = ''; + } + + $extraOptions = Xml::tags( 'td', array( 'colspan' => 2 ), + $deletedOnlyCheck . Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ), Xml::checkLabel( $this->msg( 'sp-contributions-toponly' )->text(), -- 2.20.1