(bug 23721) Only show deletedOnly checkbox on contribs and history if the user can...
authorAlex Monk <krenair@gmail.com>
Sat, 13 Oct 2012 14:05:00 +0000 (15:05 +0100)
committerAlex Monk <krenair@gmail.com>
Sun, 14 Oct 2012 01:03:07 +0000 (02:03 +0100)
Change-Id: Id47f2883e22a8742d4e5c322c349743e9101f4a3

includes/actions/HistoryAction.php
includes/specials/SpecialContributions.php

index a2d49e6..61de3b6 100644 (file)
@@ -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 );
index 54f8e26..ca8c9c8 100644 (file)
@@ -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(),