Merge "Give links to a user's suppressed edits on Special:Contribs"
[lhc/web/wiklou.git] / includes / specials / SpecialContributions.php
index 7df00e2..3642750 100644 (file)
@@ -74,6 +74,7 @@ class SpecialContributions extends IncludableSpecialPage {
                $this->opts['limit'] = $request->getInt( 'limit', $user->getOption( 'rclimit' ) );
                $this->opts['target'] = $target;
                $this->opts['topOnly'] = $request->getBool( 'topOnly' );
+               $this->opts['newOnly'] = $request->getBool( 'newOnly' );
 
                $nt = Title::makeTitleSafe( NS_USER, $target );
                if ( !$nt ) {
@@ -140,6 +141,9 @@ class SpecialContributions extends IncludableSpecialPage {
                if ( $this->opts['topOnly'] ) {
                        $feedParams['toponly'] = true;
                }
+               if ( $this->opts['newOnly'] ) {
+                       $feedParams['newonly'] = true;
+               }
                if ( $this->opts['deletedOnly'] ) {
                        $feedParams['deletedonly'] = true;
                }
@@ -185,6 +189,7 @@ class SpecialContributions extends IncludableSpecialPage {
                                'month' => $this->opts['month'],
                                'deletedOnly' => $this->opts['deletedOnly'],
                                'topOnly' => $this->opts['topOnly'],
+                               'newOnly' => $this->opts['newOnly'],
                                'nsInvert' => $this->opts['nsInvert'],
                                'associated' => $this->opts['associated'],
                        ) );
@@ -414,6 +419,10 @@ class SpecialContributions extends IncludableSpecialPage {
                        $this->opts['topOnly'] = false;
                }
 
+               if ( !isset( $this->opts['newOnly'] ) ) {
+                       $this->opts['newOnly'] = false;
+               }
+
                $form = Html::openElement(
                        'form',
                        array(
@@ -433,6 +442,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        'year',
                        'month',
                        'topOnly',
+                       'newOnly',
                        'associated'
                );
 
@@ -565,10 +575,21 @@ class SpecialContributions extends IncludableSpecialPage {
                                array( 'class' => 'mw-input' )
                        )
                );
+               $checkLabelNewOnly = Html::rawElement(
+                       'span',
+                       array( 'style' => 'white-space: nowrap' ),
+                       Xml::checkLabel(
+                               $this->msg( 'sp-contributions-newonly' )->text(),
+                               'newOnly',
+                               'mw-show-new-only',
+                               $this->opts['newOnly'],
+                               array( 'class' => 'mw-input' )
+                       )
+               );
                $extraOptions = Html::rawElement(
                        'td',
                        array( 'colspan' => 2 ),
-                       $deletedOnlyCheck . $checkLabelTopOnly
+                       $deletedOnlyCheck . $checkLabelTopOnly . $checkLabelNewOnly
                );
 
                $dateSelectionAndSubmit = Xml::tags( 'td', array( 'colspan' => 2 ),
@@ -652,6 +673,7 @@ class ContribsPager extends ReverseChronologicalPager {
 
                $this->deletedOnly = !empty( $options['deletedOnly'] );
                $this->topOnly = !empty( $options['topOnly'] );
+               $this->newOnly = !empty( $options['newOnly'] );
 
                $year = isset( $options['year'] ) ? $options['year'] : false;
                $month = isset( $options['month'] ) ? $options['month'] : false;
@@ -831,6 +853,10 @@ class ContribsPager extends ReverseChronologicalPager {
                        $condition[] = 'rev_id = page_latest';
                }
 
+               if ( $this->newOnly ) {
+                       $condition[] = 'rev_parent_id = 0';
+               }
+
                return array( $tables, $index, $condition, $join_conds );
        }