IAlex has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/49829


Change subject: Remove useless $prefs array from Special:Watchlist
......................................................................

Remove useless $prefs array from Special:Watchlist

It is a duplicate of $defaults, so instead of calling $user->get(Bool)Option()
one more time, use the already-present value in $defaults.

I know that boolean values in $defaults are casted to integer, but
WebRequest::getBool() simply casts the result of getVal() to boolean,
so there is no problem with this.

Change-Id: I2965c8c82b8cd8bfc8dee5d81a2bfa8af9e8131f
---
M includes/specials/SpecialWatchlist.php
1 file changed, 8 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/29/49829/1

diff --git a/includes/specials/SpecialWatchlist.php 
b/includes/specials/SpecialWatchlist.php
index 39bf14c..7033de6 100644
--- a/includes/specials/SpecialWatchlist.php
+++ b/includes/specials/SpecialWatchlist.php
@@ -121,25 +121,15 @@
 
                # Extract variables from the request, falling back to user 
preferences or
                # other default values if these don't exist
-               $prefs['days'] = floatval( $user->getOption( 'watchlistdays' ) 
);
-               $prefs['hideminor'] = $user->getBoolOption( 
'watchlisthideminor' );
-               $prefs['hidebots'] = $user->getBoolOption( 'watchlisthidebots' 
);
-               $prefs['hideanons'] = $user->getBoolOption( 
'watchlisthideanons' );
-               $prefs['hideliu'] = $user->getBoolOption( 'watchlisthideliu' );
-               $prefs['hideown'] = $user->getBoolOption( 'watchlisthideown' );
-               $prefs['hidepatrolled'] = $user->getBoolOption( 
'watchlisthidepatrolled' );
-               $prefs['extended'] = $user->getBoolOption( 'extendwatchlist' );
-
-               # Get query variables
                $values = array();
-               $values['days'] = $request->getVal( 'days', $prefs['days'] );
-               $values['hideMinor'] = (int)$request->getBool( 'hideMinor', 
$prefs['hideminor'] );
-               $values['hideBots'] = (int)$request->getBool( 'hideBots', 
$prefs['hidebots'] );
-               $values['hideAnons'] = (int)$request->getBool( 'hideAnons', 
$prefs['hideanons'] );
-               $values['hideLiu'] = (int)$request->getBool( 'hideLiu', 
$prefs['hideliu'] );
-               $values['hideOwn'] = (int)$request->getBool( 'hideOwn', 
$prefs['hideown'] );
-               $values['hidePatrolled'] = (int)$request->getBool( 
'hidePatrolled', $prefs['hidepatrolled'] );
-               $values['extended'] = (int)$request->getBool( 'extended', 
$prefs['extended'] );
+               $values['days'] = $request->getVal( 'days', $defaults['days'] );
+               $values['hideMinor'] = (int)$request->getBool( 'hideMinor', 
$defaults['hideMinor'] );
+               $values['hideBots'] = (int)$request->getBool( 'hideBots', 
$defaults['hideBots'] );
+               $values['hideAnons'] = (int)$request->getBool( 'hideAnons', 
$defaults['hideAnons'] );
+               $values['hideLiu'] = (int)$request->getBool( 'hideLiu', 
$defaults['hideLiu'] );
+               $values['hideOwn'] = (int)$request->getBool( 'hideOwn', 
$defaults['hideOwn'] );
+               $values['hidePatrolled'] = (int)$request->getBool( 
'hidePatrolled', $defaults['hidePatrolled'] );
+               $values['extended'] = (int)$request->getBool( 'extended', 
$defaults['extended'] );
                foreach( $this->customFilters as $key => $params ) {
                        $values[$key] = (int)$request->getBool( $key );
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2965c8c82b8cd8bfc8dee5d81a2bfa8af9e8131f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: IAlex <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to