X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecialpage%2FChangesListSpecialPage.php;h=67f68ea10aa26fc5a61c435a228b9702826d60a6;hp=bd8c4b6ec752ca13e5df70a58691bb10c495b4c2;hb=d94c0484302f80cf30ef107b2fdb6b84293e1937;hpb=b31c87ab91b3e2bbb80d3b814953ea3790498c36 diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index bd8c4b6ec7..67f68ea10a 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -1192,7 +1192,10 @@ abstract class ChangesListSpecialPage extends SpecialPage { * @param FormOptions $opts */ public function validateOptions( FormOptions $opts ) { - if ( $this->fixContradictoryOptions( $opts ) ) { + $isContradictory = $this->fixContradictoryOptions( $opts ); + $isReplaced = $this->replaceOldOptions( $opts ); + + if ( $isContradictory || $isReplaced ) { $query = wfArrayToCgi( $this->convertParamsForLink( $opts->getChangedValues() ) ); $this->getOutput()->redirect( $this->getPageTitle()->getCanonicalURL( $query ) ); } @@ -1263,6 +1266,34 @@ abstract class ChangesListSpecialPage extends SpecialPage { return false; } + /** + * Replace old options 'hideanons' or 'hideliu' with structured UI equivalent + * + * @param FormOptions $opts + * @return bool True if the change was made + */ + public function replaceOldOptions( FormOptions $opts ) { + if ( !$this->isStructuredFilterUiEnabled() ) { + return false; + } + + // At this point 'hideanons' and 'hideliu' cannot be both true, + // because fixBackwardsCompatibilityOptions resets (at least) 'hideanons' in such case + if ( $opts[ 'hideanons' ] ) { + $opts->reset( 'hideanons' ); + $opts[ 'userExpLevel' ] = 'registered'; + return true; + } + + if ( $opts[ 'hideliu' ] ) { + $opts->reset( 'hideliu' ); + $opts[ 'userExpLevel' ] = 'unregistered'; + return true; + } + + return false; + } + /** * Convert parameters values from true/false to 1/0 * so they are not omitted by wfArrayToCgi()