Petar.petkovic has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384702 )

Change subject: Replace deprecated edit review params
......................................................................

Replace deprecated edit review params

- Replace old options 'hideanons' or 'hideliu' with structured UI equivalent.

Bug: T176172
Change-Id: I6ad050f7864bf51db05c3db957ac3533358cd3ac
---
M includes/specialpage/ChangesListSpecialPage.php
1 file changed, 32 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/02/384702/1

diff --git a/includes/specialpage/ChangesListSpecialPage.php 
b/includes/specialpage/ChangesListSpecialPage.php
index 20fd06a..ba37651 100644
--- a/includes/specialpage/ChangesListSpecialPage.php
+++ b/includes/specialpage/ChangesListSpecialPage.php
@@ -1185,7 +1185,10 @@
         * @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 ) );
                }
@@ -1257,6 +1260,34 @@
        }
 
        /**
+        * 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()
         * Bug 36524

-- 
To view, visit https://gerrit.wikimedia.org/r/384702
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ad050f7864bf51db05c3db957ac3533358cd3ac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Petar.petkovic <ppetko...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to