X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialWatchlist.php;h=0dd66b023df0a41c8bc7b2d1101b32a7dc7746bc;hp=cecc182f7217a9cb84c537bc4fe334aee9c4ebef;hb=da4a98830bf715bdc7bac38d61dc5ec401d99285;hpb=a8ec960e9d910acbcd0d50efad3bd73e3ae812aa diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index cecc182f72..0dd66b023d 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -97,6 +97,8 @@ class SpecialWatchlist extends ChangesListSpecialPage { parent::execute( $subpage ); if ( $this->isStructuredFilterUiEnabled() ) { + $output->addModuleStyles( [ 'mediawiki.rcfilters.highlightCircles.seenunseen.styles' ] ); + $output->addJsConfigVars( 'wgStructuredChangeFiltersLiveUpdateSupported', false ); $output->addJsConfigVars( 'wgStructuredChangeFiltersSavedQueriesPreferenceName', @@ -142,6 +144,40 @@ class SpecialWatchlist extends ChangesListSpecialPage { protected function registerFilters() { parent::registerFilters(); + // legacy 'extended' filter + $this->registerFilterGroup( new ChangesListBooleanFilterGroup( [ + 'name' => 'extended-group', + 'filters' => [ + [ + 'name' => 'extended', + 'isReplacedInStructuredUi' => true, + 'activeValue' => false, + 'default' => $this->getUser()->getBoolOption( 'extendwatchlist' ), + 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, + &$fields, &$conds, &$query_options, &$join_conds ) { + $nonRevisionTypes = [ RC_LOG ]; + Hooks::run( 'SpecialWatchlistGetNonRevisionTypes', [ &$nonRevisionTypes ] ); + if ( $nonRevisionTypes ) { + $conds[] = $dbr->makeList( + [ + 'rc_this_oldid=page_latest', + 'rc_type' => $nonRevisionTypes, + ], + LIST_OR + ); + } + }, + ] + ], + + ] ) ); + + if ( $this->isStructuredFilterUiEnabled() ) { + $this->getFilterGroup( 'lastRevision' ) + ->getFilter( 'hidepreviousrevisions' ) + ->setDefault( !$this->getUser()->getBoolOption( 'extendwatchlist' ) ); + } + $this->registerFilterGroup( new ChangesListStringOptionsFilterGroup( [ 'name' => 'watchlistactivity', 'title' => 'rcfilters-filtergroup-watchlistactivity', @@ -234,7 +270,6 @@ class SpecialWatchlist extends ChangesListSpecialPage { $user = $this->getUser(); $opts->add( 'days', $user->getOption( 'watchlistdays' ), FormOptions::FLOAT ); - $opts->add( 'extended', $user->getBoolOption( 'extendwatchlist' ) ); $opts->add( 'limit', $user->getIntOption( 'wllimit' ), FormOptions::INT ); return $opts; @@ -298,8 +333,11 @@ class SpecialWatchlist extends ChangesListSpecialPage { // unchecked boxes. foreach ( $this->filterGroups as $filterGroup ) { if ( $filterGroup instanceof ChangesListBooleanFilterGroup ) { + /** @var ChangesListBooleanFilter $filter */ foreach ( $filterGroup->getFilters() as $filter ) { - $allBooleansFalse[$filter->getName()] = false; + if ( $filter->displaysOnUnstructuredUi() ) { + $allBooleansFalse[$filter->getName()] = false; + } } } } @@ -341,22 +379,6 @@ class SpecialWatchlist extends ChangesListSpecialPage { $dbr = $this->getDB(); $user = $this->getUser(); - # Toggle watchlist content (all recent edits or just the latest) - if ( !$opts['extended'] ) { - # Top log Ids for a page are not stored - $nonRevisionTypes = [ RC_LOG ]; - Hooks::run( 'SpecialWatchlistGetNonRevisionTypes', [ &$nonRevisionTypes ] ); - if ( $nonRevisionTypes ) { - $conds[] = $dbr->makeList( - [ - 'rc_this_oldid=page_latest', - 'rc_type' => $nonRevisionTypes, - ], - LIST_OR - ); - } - } - $tables = array_merge( [ 'recentchanges', 'watchlist' ], $tables ); $fields = array_merge( RecentChange::selectFields(), $fields ); @@ -858,4 +880,12 @@ class SpecialWatchlist extends ChangesListSpecialPage { $count = $store->countWatchedItems( $this->getUser() ); return floor( $count / 2 ); } + + function getDefaultLimit() { + return $this->getUser()->getIntOption( 'wllimit' ); + } + + function getDefaultDays() { + return $this->getUser()->getIntOption( 'watchlistdays' ); + } }