Convert Watchlist settings to new UX, with following rules:
- If "Hide edits by anonymous users from the watchlist" is checked,
add "Registered" filter to defaults.
- If "Hide edits by logged in users from the watchlist" is checked,
add "Unregistered" filter to defaults.
- Change test for Special:Watchlist page, so new structured filters
are supported.
Bug: T172757
Change-Id: I27bdaa1401323fa3143f79a57dc5b9773e48fd1d
$hideLiu = $registration->getFilter( 'hideliu' );
$hideLiu->setDefault( $user->getBoolOption( 'watchlisthideliu' ) );
$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
$reviewStatus = $this->getFilterGroup( 'reviewStatus' );
if ( $reviewStatus !== null ) {
// Conditional on feature being available and rights
// Second two overriden
'hideanons' => false,
'hideliu' => true,
// Second two overriden
'hideanons' => false,
'hideliu' => true,
+ 'userExpLevel' => 'registered'
] + $wikiDefaults,
[
'watchlisthideminor' => 1,
] + $wikiDefaults,
[
'watchlisthideminor' => 1,
'hidebots' => true,
'hideanons' => false,
'hideliu' => true,
'hidebots' => true,
'hideanons' => false,
'hideliu' => true,
+ 'userExpLevel' => 'unregistered'
] + $allFalse,
[
'watchlisthideminor' => 0,
'watchlisthidebots' => 1,
] + $allFalse,
[
'watchlisthideminor' => 0,
'watchlisthidebots' => 1,
- 'watchlisthideanons' => 1,
- 'watchlisthideliu' => 0,
+
+ 'watchlisthideanons' => 0,
+ 'watchlisthideliu' => 1,