* @ingroup SpecialPage
*/
class SpecialWatchlist extends ChangesListSpecialPage {
+ protected static $savedQueriesPreferenceName = 'rcfilters-wl-saved-queries';
+
private $maxDays;
public function __construct( $page = 'Watchlist', $restriction = 'viewmywatchlist' ) {
$output->addModuleStyles( [ 'mediawiki.rcfilters.highlightCircles.seenunseen.styles' ] );
$output->addJsConfigVars( 'wgStructuredChangeFiltersLiveUpdateSupported', false );
- $output->addJsConfigVars(
- 'wgStructuredChangeFiltersSavedQueriesPreferenceName',
- 'rcfilters-wl-saved-queries'
- );
$output->addJsConfigVars(
'wgStructuredChangeFiltersEditWatchlistUrl',
SpecialPage::getTitleFor( 'EditWatchlist' )->getLocalURL()
}
public function isStructuredFilterUiEnabled() {
- return parent::isStructuredFilterUiEnabled()
- && ( $this->getConfig()->get( 'StructuredChangeFiltersOnWatchlist' )
- || $this->getRequest()->getBool( 'rcfilters' ) );
+ return $this->getRequest()->getBool( 'rcfilters' ) || (
+ $this->getConfig()->get( 'StructuredChangeFiltersOnWatchlist' ) &&
+ $this->getUser()->getOption( 'rcenhancedfilters' )
+ );
+ }
+
+ public function isStructuredFilterUiEnabledByDefault() {
+ return $this->getConfig()->get( 'StructuredChangeFiltersOnWatchlist' ) &&
+ $this->getUser()->getDefaultOption( 'rcenhancedfilters' );
}
/**
*/
public function getDefaultOptions() {
$opts = parent::getDefaultOptions();
- $user = $this->getUser();
- $opts->add( 'days', $user->getOption( 'watchlistdays' ), FormOptions::FLOAT );
- $opts->add( 'limit', $user->getIntOption( 'wllimit' ), FormOptions::INT );
+ $opts->add( 'days', $this->getDefaultDays(), FormOptions::FLOAT );
+ $opts->add( 'limit', $this->getDefaultLimit(), FormOptions::INT );
return $opts;
}
'id' => 'mw-watchlist-form'
] );
$form .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() );
- $form .= Xml::fieldset(
- $this->msg( 'watchlist-options' )->text(),
- false,
+ $form .= Xml::openElement(
+ 'fieldset',
[ 'id' => 'mw-watchlist-options', 'class' => 'cloptions' ]
);
+ $form .= Xml::element(
+ 'legend', null, $this->msg( 'watchlist-options' )->text()
+ );
if ( !$this->isStructuredFilterUiEnabled() ) {
$form .= $this->makeLegend();
}
function getDefaultDays() {
- return $this->getUser()->getIntOption( 'watchlistdays' );
+ return floatval( $this->getUser()->getOption( 'watchlistdays' ) );
}
}