Hide category changes if feature is disabled
[lhc/web/wiklou.git] / includes / specials / SpecialWatchlist.php
index e22a8e6..cc5c150 100644 (file)
@@ -44,6 +44,9 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                $output = $this->getOutput();
                $request = $this->getRequest();
                $this->addHelpLink( 'Help:Watching pages' );
+               $output->addModules( array(
+                       'mediawiki.special.changeslist.visitedstatus',
+               ) );
 
                $mode = SpecialEditWatchlist::getMode( $request, $subpage );
                if ( $mode !== false ) {
@@ -115,10 +118,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                $opts->add( 'hideliu', $user->getBoolOption( 'watchlisthideliu' ) );
                $opts->add( 'hidepatrolled', $user->getBoolOption( 'watchlisthidepatrolled' ) );
                $opts->add( 'hidemyself', $user->getBoolOption( 'watchlisthideown' ) );
-
-               if ( $this->getConfig()->get( 'RCWatchCategoryMembership' ) ) {
-                       $opts->add( 'hidecategorization', $user->getBoolOption( 'watchlisthidecategorization' ) );
-               }
+               $opts->add( 'hidecategorization', $user->getBoolOption( 'watchlisthidecategorization' ) );
 
                return $opts;
        }
@@ -419,13 +419,15 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                $this->setTopText( $opts );
 
                $lang = $this->getLanguage();
-               $wlInfo = '';
                if ( $opts['days'] > 0 ) {
-                       $timestamp = wfTimestampNow();
-                       $wlInfo = $this->msg( 'wlnote' )->numParams( $numRows, round( $opts['days'] * 24 ) )->params(
-                               $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user )
-                       )->parse() . "<br />\n";
+                       $days = $opts['days'];
+               } else {
+                       $days = $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 );
                }
+               $timestamp = wfTimestampNow();
+               $wlInfo = $this->msg( 'wlnote' )->numParams( $numRows, round( $days * 24 ) )->params(
+                       $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user )
+               )->parse() . "<br />\n";
 
                $nondefaults = $opts->getChangedValues();
                $cutofflinks = $this->msg( 'wlshowtime' ) . ' ' . $this->cutoffselector( $opts );
@@ -441,7 +443,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                );
 
                if ( $this->getConfig()->get( 'RCWatchCategoryMembership' ) ) {
-                       $filters['hidecategorization'] = 'rcshowhidecategorization';
+                       $filters['hidecategorization'] = 'wlshowhidecategorization';
                }
 
                foreach ( $this->getCustomFilters() as $key => $params ) {
@@ -527,9 +529,19 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                        $days[] = $userWatchlistOption;
                }
 
+               $maxDays = (string)( $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
+               // add the maximum possible value, if it isn't available already
+               if ( !in_array( $maxDays, $days ) ) {
+                       $days[] = $maxDays;
+               }
+
                $selected = (string)$options['days'];
+               if ( $selected <= 0 ) {
+                       $selected = $maxDays;
+               }
+
                // add the currently selected value, if it isn't available already
-               if ( !in_array( $selected, $days ) && $selected !== '0' ) {
+               if ( !in_array( $selected, $days ) ) {
                        $days[] = $selected;
                }
 
@@ -545,11 +557,6 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                        $select->addOption( $name, $value );
                }
 
-               // 'all' option
-               $name = $this->msg( 'watchlistall2' )->text();
-               $value = '0';
-               $select->addOption( $name, $value );
-
                return $select->getHTML() . "\n<br />\n";
        }
 
@@ -602,7 +609,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                        array( 'id' => 'mw-watchlist-options' )
                );
 
-               $form .= SpecialRecentChanges::makeLegend( $this->getContext() );
+               $form .= $this->makeLegend();
 
                $this->getOutput()->addHTML( $form );
        }