*/
class SpecialRecentChanges extends ChangesListSpecialPage {
+ protected static $savedQueriesPreferenceName = 'rcfilters-saved-queries';
+
private $watchlistFilterGroupDefinition;
// @codingStandardsIgnoreStart Needed "useless" override to change parameters.
true
);
parent::execute( $subpage );
-
- if ( $this->isStructuredFilterUiEnabled() ) {
- $out->addJsConfigVars( 'wgStructuredChangeFiltersLiveUpdateSupported', true );
- $out->addJsConfigVars(
- 'wgStructuredChangeFiltersSavedQueriesPreferenceName',
- 'rcfilters-saved-queries'
- );
- }
}
/**
public function getDefaultOptions() {
$opts = parent::getDefaultOptions();
- $opts->add( 'days', $this->getDefaultDays(), FormOptions::FLOAT );
- $opts->add( 'limit', $this->getDefaultLimit() );
- $opts->add( 'from', '' );
-
$opts->add( 'categories', '' );
$opts->add( 'categories_any', false );
}
}
- public function validateOptions( FormOptions $opts ) {
- $opts->validateIntBounds( 'limit', 0, 5000 );
- $opts->validateBounds( 'days', 0, $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
- parent::validateOptions( $opts );
- }
-
- /**
- * @inheritDoc
- */
- protected function buildQuery( &$tables, &$fields, &$conds,
- &$query_options, &$join_conds, FormOptions $opts
- ) {
- $dbr = $this->getDB();
- parent::buildQuery( $tables, $fields, $conds,
- $query_options, $join_conds, $opts );
-
- // Calculate cutoff
- $cutoff_unixtime = time() - $opts['days'] * 3600 * 24;
- $cutoff = $dbr->timestamp( $cutoff_unixtime );
-
- $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
- if ( $fromValid && $opts['from'] > wfTimestamp( TS_MW, $cutoff ) ) {
- $cutoff = $dbr->timestamp( $opts['from'] );
- } else {
- $opts->reset( 'from' );
- }
-
- $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
- }
-
/**
* @inheritDoc
*/
$topLinksAttributes = [ 'class' => 'mw-recentchanges-toplinks' ];
if ( $this->isStructuredFilterUiEnabled() ) {
+ // Check whether the widget is already collapsed or expanded
+ $collapsedState = $this->getRequest()->getCookie( 'rcfilters-toplinks-collapsed-state' );
+ // Note that an empty/unset cookie means collapsed, so check for !== 'expanded'
+ $collapsedClass = $collapsedState !== 'expanded' ? 'mw-rcfilters-toplinks-collapsed' : '';
+
$contentTitle = Html::rawElement( 'div',
- [ 'class' => 'mw-recentchanges-toplinks-title' ],
+ [ 'class' => 'mw-recentchanges-toplinks-title ' . $collapsedClass ],
$this->msg( 'rcfilters-other-review-tools' )->parse()
);
$contentWrapper = Html::rawElement( 'div',
- array_merge( [ 'class' => 'mw-collapsible-content' ], $langAttributes ),
+ array_merge(
+ [
+ 'class' => 'mw-recentchanges-toplinks-content mw-collapsible-content ' .
+ $collapsedClass
+ ],
+ $langAttributes
+ ),
$content
);
$content = $contentTitle . $contentWrapper;