X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialWatchlist.php;h=921a6dd465458450441b830a7da3af4a6931138c;hb=252fa957ad2442d25ce2d5b7f06ecfd71da2c1f9;hp=8a474864f086ba0953edf1f023a9839dae67ddfd;hpb=b8dfbe878c9a30b671af50768be337aed99372b3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 8a474864f0..921a6dd465 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -248,6 +248,22 @@ class SpecialWatchlist extends ChangesListSpecialPage { $hideLiu = $registration->getFilter( 'hideliu' ); $hideLiu->setDefault( $user->getBoolOption( 'watchlisthideliu' ) ); + // Selecting both hideanons and hideliu on watchlist preferances + // gives mutually exclusive filters, so those are ignored + if ( $user->getBoolOption( 'watchlisthideanons' ) && + !$user->getBoolOption( 'watchlisthideliu' ) + ) { + $this->getFilterGroup( 'userExpLevel' ) + ->setDefault( 'registered' ); + } + + if ( $user->getBoolOption( 'watchlisthideliu' ) && + !$user->getBoolOption( 'watchlisthideanons' ) + ) { + $this->getFilterGroup( 'userExpLevel' ) + ->setDefault( 'unregistered' ); + } + $reviewStatus = $this->getFilterGroup( 'reviewStatus' ); if ( $reviewStatus !== null ) { // Conditional on feature being available and rights @@ -317,15 +333,8 @@ class SpecialWatchlist extends ChangesListSpecialPage { // This is how we handle the fact that HTML forms don't submit // unchecked boxes. - foreach ( $this->filterGroups as $filterGroup ) { - if ( $filterGroup instanceof ChangesListBooleanFilterGroup ) { - /** @var ChangesListBooleanFilter $filter */ - foreach ( $filterGroup->getFilters() as $filter ) { - if ( $filter->displaysOnUnstructuredUi() ) { - $allBooleansFalse[$filter->getName()] = false; - } - } - } + foreach ( $this->getLegacyShowHideFilters() as $filter ) { + $allBooleansFalse[ $filter->getName() ] = false; } $params = $params + $allBooleansFalse; @@ -630,21 +639,15 @@ class SpecialWatchlist extends ChangesListSpecialPage { # Spit out some control panel links $links = []; $namesOfDisplayedFilters = []; - foreach ( $this->getFilterGroups() as $groupName => $group ) { - if ( !$group->isPerGroupRequestParameter() ) { - foreach ( $group->getFilters() as $filterName => $filter ) { - if ( $filter->displaysOnUnstructuredUi( $this ) ) { - $namesOfDisplayedFilters[] = $filterName; - $links[] = $this->showHideCheck( - $nondefaults, - $filter->getShowHide(), - $filterName, - $opts[$filterName], - $filter->isFeatureAvailableOnStructuredUi( $this ) - ); - } - } - } + foreach ( $this->getLegacyShowHideFilters() as $filterName => $filter ) { + $namesOfDisplayedFilters[] = $filterName; + $links[] = $this->showHideCheck( + $nondefaults, + $filter->getShowHide(), + $filterName, + $opts[ $filterName ], + $filter->isFeatureAvailableOnStructuredUi( $this ) + ); } $hiddenFields = $nondefaults;