Awight has uploaded a new change for review.
https://gerrit.wikimedia.org/r/264608
Change subject: [WIP] Filter out non-damaging changes in Special:Contributions
......................................................................
[WIP] Filter out non-damaging changes in Special:Contributions
TODO: Doesn't provide a checkbox to set the hidenondamaging param.
Bug: T122537
Change-Id: If4b2229653de03a42ab3991200a8c6d6ccda7edb
---
M extension.json
M includes/Hooks.php
2 files changed, 28 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES
refs/changes/08/264608/1
diff --git a/extension.json b/extension.json
index 2b9f1ec..0f1fc29 100644
--- a/extension.json
+++ b/extension.json
@@ -28,6 +28,9 @@
"ChangesListSpecialPageQuery": [
"ORES\\Hooks::onChangesListSpecialPageQuery"
],
+ "ContribsPager::getQueryInfo": [
+ "ORES\\Hooks::onContribsGetQueryInfo"
+ ],
"EnhancedChangesListModifyBlockLineData": [
"ORES\\Hooks::onEnhancedChangesListModifyBlockLineData"
],
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 835f94e..5221d29 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -155,6 +155,31 @@
}
/**
+ * Filter out non-damaging changes from Special:Contributions
+ *
+ * @param ContribsPager $pager
+ * @param array $query
+ */
+ public static function onContribsGetQueryInfo( $pager, &$query ) {
+ global $wgOresDamagingThreshold;
+
+ $query['tables'][] = 'ores_classification';
+ $query['fields'][] = 'ores_probability';
+ $query['join_conds']['ores_classification'] = array( 'LEFT
JOIN',
+ 'rev_id = ores_rev AND ores_model = \'damaging\' ' .
+ 'AND ores_is_predicted = 1 AND ores_class = \'true\'' );
+
+ if ( $pager->getContext()->getRequest()->getVal(
'hidenondamaging' ) ) {
+ // Filter out non-damaging edits.
+ $query['conds'][] = 'ores_is_predicted = 1';
+ $query['conds'][] = 'ores_probability > '
+ . wfGetDb( DB_SLAVE )->addQuotes(
$wgOresDamagingThreshold );
+ }
+
+ return true;
+ }
+
+ /**
* Internal helper to label matching rows
*/
protected static function processRecentChangesList( RCCacheEntry
$rcObj, array &$data ) {
--
To view, visit https://gerrit.wikimedia.org/r/264608
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If4b2229653de03a42ab3991200a8c6d6ccda7edb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits