Merge "RCFilters: rephrase newcomers description"
[lhc/web/wiklou.git] / includes / specials / SpecialWatchlist.php
index 8a47486..921a6dd 100644 (file)
@@ -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;