// Same format as filterGroupDefinitions, but for a single group (reviewStatus)
// that is registered conditionally.
+ private $legacyReviewStatusFilterGroupDefinition;
+
+ // Single filter group registered conditionally
private $reviewStatusFilterGroupDefinition;
- // Single filter registered conditionally
+ // Single filter group registered conditionally
private $hideCategorizationFilterDefinition;
/**
]
],
- // reviewStatus (conditional)
+ // significance (conditional)
[
'name' => 'significance',
];
- $this->reviewStatusFilterGroupDefinition = [
+ $this->legacyReviewStatusFilterGroupDefinition = [
[
- 'name' => 'reviewStatus',
+ 'name' => 'legacyReviewStatus',
'title' => 'rcfilters-filtergroup-reviewstatus',
'class' => ChangesListBooleanFilterGroup::class,
- 'priority' => -5,
'filters' => [
[
'name' => 'hidepatrolled',
- 'label' => 'rcfilters-filter-patrolled-label',
- 'description' => 'rcfilters-filter-patrolled-description',
// rcshowhidepatr-show, rcshowhidepatr-hide
// wlshowhidepatr
'showHideSuffix' => 'showhidepatr',
) {
$conds[] = 'rc_patrolled = 0';
},
- 'cssClassSuffix' => 'patrolled',
- 'isRowApplicableCallable' => function ( $ctx, $rc ) {
- return $rc->getAttribute( 'rc_patrolled' );
- },
+ 'isReplacedInStructuredUi' => true,
],
[
'name' => 'hideunpatrolled',
- 'label' => 'rcfilters-filter-unpatrolled-label',
- 'description' => 'rcfilters-filter-unpatrolled-description',
'default' => false,
'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds,
&$query_options, &$join_conds
) {
$conds[] = 'rc_patrolled != 0';
},
- 'cssClassSuffix' => 'unpatrolled',
+ 'isReplacedInStructuredUi' => true,
+ ],
+ ],
+ ]
+ ];
+
+ $this->reviewStatusFilterGroupDefinition = [
+ [
+ 'name' => 'reviewStatus',
+ 'title' => 'rcfilters-filtergroup-reviewstatus',
+ 'class' => ChangesListStringOptionsFilterGroup::class,
+ 'isFullCoverage' => true,
+ 'priority' => -5,
+ 'filters' => [
+ [
+ 'name' => 'unpatrolled',
+ 'label' => 'rcfilters-filter-reviewstatus-unpatrolled-label',
+ 'description' => 'rcfilters-filter-reviewstatus-unpatrolled-description',
+ 'cssClassSuffix' => 'reviewstatus-unpatrolled',
+ 'isRowApplicableCallable' => function ( $ctx, $rc ) {
+ return $rc->getAttribute( 'rc_patrolled' ) == RecentChange::PRC_UNPATROLLED;
+ },
+ ],
+ [
+ 'name' => 'manual',
+ 'label' => 'rcfilters-filter-reviewstatus-manual-label',
+ 'description' => 'rcfilters-filter-reviewstatus-manual-description',
+ 'cssClassSuffix' => 'reviewstatus-manual',
'isRowApplicableCallable' => function ( $ctx, $rc ) {
- return !$rc->getAttribute( 'rc_patrolled' );
+ return $rc->getAttribute( 'rc_patrolled' ) == RecentChange::PRC_PATROLLED;
+ },
+ ],
+ [
+ 'name' => 'auto',
+ 'label' => 'rcfilters-filter-reviewstatus-auto-label',
+ 'description' => 'rcfilters-filter-reviewstatus-auto-description',
+ 'cssClassSuffix' => 'reviewstatus-auto',
+ 'isRowApplicableCallable' => function ( $ctx, $rc ) {
+ return $rc->getAttribute( 'rc_patrolled' ) == RecentChange::PRC_AUTOPATROLLED;
},
],
],
+ 'default' => ChangesListStringOptionsFilterGroup::NONE,
+ 'queryCallable' => function ( $specialPageClassName, $ctx, $dbr,
+ &$tables, &$fields, &$conds, &$query_options, &$join_conds, $selected
+ ) {
+ if ( $selected === [] ) {
+ return;
+ }
+ $rcPatrolledValues = [
+ 'unpatrolled' => RecentChange::PRC_UNPATROLLED,
+ 'manual' => RecentChange::PRC_PATROLLED,
+ 'auto' => RecentChange::PRC_AUTOPATROLLED,
+ ];
+ // e.g. rc_patrolled IN (0, 2)
+ $conds['rc_patrolled'] = array_map( function ( $s ) use ( $rcPatrolledValues ) {
+ return $rcPatrolledValues[ $s ];
+ }, $selected );
+ }
]
];
// information to all users just because the user that saves the edit can
// patrol or is logged in)
if ( !$this->including() && $this->getUser()->useRCPatrol() ) {
+ $this->registerFiltersFromDefinitions( $this->legacyReviewStatusFilterGroupDefinition );
$this->registerFiltersFromDefinitions( $this->reviewStatusFilterGroupDefinition );
}
}
/**
- * Replace old options 'hideanons' or 'hideliu' with structured UI equivalent
+ * Replace old options with their structured UI equivalents
*
* @param FormOptions $opts
* @return bool True if the change was made
return false;
}
+ $changed = 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;
+ $changed = true;
}
if ( $opts[ 'hideliu' ] ) {
$opts->reset( 'hideliu' );
$opts[ 'userExpLevel' ] = 'unregistered';
- return true;
+ $changed = true;
}
- return false;
+ if ( $this->getFilterGroup( 'legacyReviewStatus' ) ) {
+ if ( $opts[ 'hidepatrolled' ] ) {
+ $opts->reset( 'hidepatrolled' );
+ $opts[ 'reviewStatus' ] = 'unpatrolled';
+ $changed = true;
+ }
+
+ if ( $opts[ 'hideunpatrolled' ] ) {
+ $opts->reset( 'hideunpatrolled' );
+ $opts[ 'reviewStatus' ] = implode(
+ ChangesListStringOptionsFilterGroup::SEPARATOR,
+ [ 'manual', 'auto' ]
+ );
+ $changed = true;
+ }
+ }
+
+ return $changed;
}
/**
"rcfilters-filter-humans-label": "Human (not bot)",
"rcfilters-filter-humans-description": "Edits made by human editors.",
"rcfilters-filtergroup-reviewstatus": "Review status",
- "rcfilters-filter-patrolled-label": "Patrolled",
- "rcfilters-filter-patrolled-description": "Edits marked as patrolled.",
- "rcfilters-filter-unpatrolled-label": "Unpatrolled",
- "rcfilters-filter-unpatrolled-description": "Edits not marked as patrolled.",
+ "rcfilters-filter-reviewstatus-unpatrolled-description": "Edits not manually or automatically marked as patrolled.",
+ "rcfilters-filter-reviewstatus-unpatrolled-label": "Unpatrolled",
+ "rcfilters-filter-reviewstatus-manual-description": "Edits manually marked as patrolled.",
+ "rcfilters-filter-reviewstatus-manual-label": "Manually patrolled",
+ "rcfilters-filter-reviewstatus-auto-description": "Edits by advanced users whose work is automatically marked as patrolled.",
+ "rcfilters-filter-reviewstatus-auto-label": "Autopatrolled",
"rcfilters-filtergroup-significance": "Significance",
"rcfilters-filter-minor-label": "Minor edits",
"rcfilters-filter-minor-description": "Edits the author labeled as minor.",
"rcfilters-filter-humans-label": "Label for the filter for showing edits made by human editors.",
"rcfilters-filter-humans-description": "Description for the filter for showing edits made by human editors.",
"rcfilters-filtergroup-reviewstatus": "Title for the filter group about review status (in core this is whether it's been patrolled)",
- "rcfilters-filter-patrolled-label": "Label for the filter for showing patrolled edits",
- "rcfilters-filter-patrolled-description": "Label for the filter showing patrolled edits",
- "rcfilters-filter-unpatrolled-label": "Label for the filter for showing unpatrolled edits",
- "rcfilters-filter-unpatrolled-description": "Description for the filter for showing unpatrolled edits",
+ "rcfilters-filter-reviewstatus-manual-description": "Description for the filter showing manually patrolled edits",
+ "rcfilters-filter-reviewstatus-manual-label": "Label for the filter showing manually patrolled edits",
+ "rcfilters-filter-reviewstatus-auto-description": "Description for the filter showing automatically patrolled edits",
+ "rcfilters-filter-reviewstatus-auto-label": "Label for the filter showing automatically patrolled edits",
+ "rcfilters-filter-reviewstatus-unpatrolled-description": "Description for the filter for showing unpatrolled edits",
+ "rcfilters-filter-reviewstatus-unpatrolled-label": "Label for the filter for showing unpatrolled edits",
"rcfilters-filtergroup-significance": "Title for the filter group for edit significance.\n{{Identical|Significance}}",
"rcfilters-filter-minor-label": "Label for the filter for showing edits marked as minor.",
"rcfilters-filter-minor-description": "Description for the filter for showing edits marked as minor.",