jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/367841 )
Change subject: Treat RC_LOG and RC_EXTERNAL rows as unscorable
......................................................................
Treat RC_LOG and RC_EXTERNAL rows as unscorable
Refuse to consider their scores in the applicable callback
(used for highlighting in RCFilters), and filter out these
types in the query callback for the damaging/goodfaith filters.
In particular, this prevents Wikidata rows from being highlighted,
and from appearing when a damaging/goodfaith filter is active.
Bug: T168487
Change-Id: Ib103723ba4622bc5860dbea029dc0cb43e821c7e
---
M includes/Hooks.php
1 file changed, 11 insertions(+), 1 deletion(-)
Approvals:
Sbisson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Hooks.php b/includes/Hooks.php
index a60ac5c..59ef2bd 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -178,6 +178,10 @@
$condition =
self::buildRangeFilter( 'damaging', $selectedValues );
if ( $condition ) {
$conds[] = $condition;
+
+ // Filter out
incompatible types; log actions and external rows are not scorable
+ $conds[] = 'rc_type NOT
IN (' . $dbr->makeList( [ RC_LOG, RC_EXTERNAL ] ) . ')';
+ // Make the joins INNER
JOINs instead of LEFT JOINs
$join_conds['ores_damaging_mdl'][0] = 'INNER JOIN';
$join_conds['ores_damaging_cls'][0] = 'INNER JOIN';
// Performance hack:
add STRAIGHT_JOIN (146111)
@@ -320,6 +324,10 @@
$condition =
self::buildRangeFilter( 'goodfaith', $selectedValues );
if ( $condition ) {
$conds[] = $condition;
+
+ // Filter out
incompatible types; log actions and external rows are not scorable
+ $conds[] = 'rc_type NOT
IN (' . $dbr->makeList( [ RC_LOG, RC_EXTERNAL ] ) . ')';
+ // Make the joins INNER
JOINs instead of LEFT JOINs
$join_conds['ores_goodfaith_mdl'][0] = 'INNER JOIN';
$join_conds['ores_goodfaith_cls'][0] = 'INNER JOIN';
// Performance hack:
add STRAIGHT_JOIN (146111)
@@ -912,7 +920,9 @@
private static function makeApplicableCallback( $model, array
$levelData ) {
return function ( $ctx, $rc ) use ( $model, $levelData ) {
$score = $rc->getAttribute( "ores_{$model}_score" );
- if ( $score === null ) {
+ $type = $rc->getAttribute( 'rc_type' );
+ // Log actions and external rows are not scorable; if
such a row does have a score, ignore it
+ if ( $score === null || in_array( $type, [ RC_LOG,
RC_EXTERNAL ] ) ) {
return false;
}
return $levelData['min'] <= $score && $score <=
$levelData['max'];
--
To view, visit https://gerrit.wikimedia.org/r/367841
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib103723ba4622bc5860dbea029dc0cb43e821c7e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Sbisson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits