[MediaWiki-commits] [Gerrit] mediawiki...ORES[master]: Follow-up a93bd12: also ignore RC_LOG/RC_EXTERNAL in non-RCF...

2017-07-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/368117 )

Change subject: Follow-up a93bd12: also ignore RC_LOG/RC_EXTERNAL in 
non-RCFilters UI
..


Follow-up a93bd12: also ignore RC_LOG/RC_EXTERNAL in non-RCFilters UI

Filter out RC_LOG and RC_EXTERNAL when hidenondamaging=1 is set,
and never apply the 'r' or highlighting to such rows.

Bug: T168487
Change-Id: I06f9985a40e4ab8269d35d10ffa30834d5c35e09
---
M includes/Hooks.php
1 file changed, 7 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/includes/Hooks.php b/includes/Hooks.php
index 59ef2bd..fbc3f1b 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -241,7 +241,11 @@
'queryCallable' => function ( 
$specialClassName, $ctx, $dbr, &$tables,
&$fields, 
&$conds, &$query_options, &$join_conds ) {

self::hideNonDamagingFilter( $fields, $conds, true, $ctx->getUser() );
+   // Filter out 
incompatible types; log actions and external rows are not scorable
+   $conds[] = 'rc_type NOT 
IN (' . $dbr->makeList( [ RC_LOG, RC_EXTERNAL ] ) . ')';
+   // Filter out patrolled 
edits: the 'r' doesn't appear for them
$conds['rc_patrolled'] 
= 0;
+   // 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)
@@ -632,8 +636,10 @@
}
$score = $rcObj->getAttribute( 'ores_damaging_score' );
$patrolled = $rcObj->getAttribute( 'rc_patrolled' );
+   $type = $rcObj->getAttribute( 'rc_type' );
 
-   if ( !$score || $threshold === null ) {
+   // Log actions and external rows are not scorable; if such a 
row does have a score, ignore it
+   if ( !$score || $threshold === null || in_array( $type, [ 
RC_LOG, RC_EXTERNAL ] ) ) {
// Shorten out
return false;
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I06f9985a40e4ab8269d35d10ffa30834d5c35e09
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Catrope 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...ORES[master]: Follow-up a93bd12: also ignore RC_LOG/RC_EXTERNAL in non-RCF...

2017-07-26 Thread Catrope (Code Review)
Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368117 )

Change subject: Follow-up a93bd12: also ignore RC_LOG/RC_EXTERNAL in 
non-RCFilters UI
..

Follow-up a93bd12: also ignore RC_LOG/RC_EXTERNAL in non-RCFilters UI

Filter out RC_LOG and RC_EXTERNAL when hidenondamaging=1 is set,
and never apply the 'r' or highlighting to such rows.

Bug: T168487
Change-Id: I06f9985a40e4ab8269d35d10ffa30834d5c35e09
---
M includes/Hooks.php
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES 
refs/changes/17/368117/1

diff --git a/includes/Hooks.php b/includes/Hooks.php
index 59ef2bd..fbc3f1b 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -241,7 +241,11 @@
'queryCallable' => function ( 
$specialClassName, $ctx, $dbr, &$tables,
&$fields, 
&$conds, &$query_options, &$join_conds ) {

self::hideNonDamagingFilter( $fields, $conds, true, $ctx->getUser() );
+   // Filter out 
incompatible types; log actions and external rows are not scorable
+   $conds[] = 'rc_type NOT 
IN (' . $dbr->makeList( [ RC_LOG, RC_EXTERNAL ] ) . ')';
+   // Filter out patrolled 
edits: the 'r' doesn't appear for them
$conds['rc_patrolled'] 
= 0;
+   // 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)
@@ -632,8 +636,10 @@
}
$score = $rcObj->getAttribute( 'ores_damaging_score' );
$patrolled = $rcObj->getAttribute( 'rc_patrolled' );
+   $type = $rcObj->getAttribute( 'rc_type' );
 
-   if ( !$score || $threshold === null ) {
+   // Log actions and external rows are not scorable; if such a 
row does have a score, ignore it
+   if ( !$score || $threshold === null || in_array( $type, [ 
RC_LOG, RC_EXTERNAL ] ) ) {
// Shorten out
return false;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I06f9985a40e4ab8269d35d10ffa30834d5c35e09
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Catrope 

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