jenkins-bot has submitted this change and it was merged.

Change subject: Switch from the "reverted" to "damaging" model
......................................................................


Switch from the "reverted" to "damaging" model

Also, cache the other models "wp10" and "goodfaith" by default.

Bug: T112856
Change-Id: I8b5ea18ea6618aefd45c53bd8cb52c0005100f50
---
M README
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/Hooks.php
M includes/Scoring.php
6 files changed, 32 insertions(+), 29 deletions(-)

Approvals:
  Ladsgroup: Looks good to me, but someone else must approve
  Awight: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README b/README
index dcbc1d5..f14df2d 100644
--- a/README
+++ b/README
@@ -6,5 +6,5 @@
 $wgOresModels - Array of models we want to fetch from the server and cache in
 the database.
 
-$wgOresRevertTagThresholds - Map from threshold name to score cutoff.  These
-thresholds are used to flag recent changes for potential revert.
+$wgOresDamagingTagThresholds - Map from threshold name to score cutoff.  These
+thresholds are used to flag recent changes that need review.
diff --git a/extension.json b/extension.json
index ed9b2e7..403b52a 100644
--- a/extension.json
+++ b/extension.json
@@ -48,20 +48,23 @@
        "config": {
                "OresBaseUrl": "https://ores.wmflabs.org/";,
                "OresModels": [
-                       "reverted"
+                       "damaging",
+                       "goodfaith",
+                       "reverted",
+                       "wp10"
                ],
-               "OresRevertTagThresholds": {
+               "OresDamagingTagThresholds": {
                        "low": 0.8,
                        "medium": 0.87,
                        "high": 0.94
                },
-               "OresRevertFilterThreshold": 0.87,
+               "OresDamagingFilterThreshold": 0.87,
                "RecentChangesFlags": {
-                       "revertedRisk": {
-                               "letter": "ores-reverted-letter",
-                               "title": "ores-reverted-title",
-                               "legend": "ores-reverted-legend",
-                               "class": "ores-reverted"
+                       "damagingRisk": {
+                               "letter": "ores-damaging-letter",
+                               "title": "ores-damaging-title",
+                               "legend": "ores-damaging-legend",
+                               "class": "ores-damaging"
                        }
                }
        },
diff --git a/i18n/en.json b/i18n/en.json
index c8fa9a4..796ff07 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -3,8 +3,8 @@
                "authors": []
        },
        "ores-desc": "Expose automated revision scores in the interface",
-       "ores-reverted-filter": "$1 good edits",
-       "ores-reverted-letter": "R",
-       "ores-reverted-title": "This edit needs review",
-       "ores-reverted-legend": "ORES predicts that this change may be damaging 
and should be reviewed"
+       "ores-damaging-filter": "$1 good edits",
+       "ores-damaging-letter": "D",
+       "ores-damaging-title": "This edit needs review",
+       "ores-damaging-legend": "ORES predicts that this change may be damaging 
and should be reviewed"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 1e1a06f..418221e 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -1,8 +1,8 @@
 {
        "@metadata": [],
        "ores-desc": "Extension summary.",
-       "ores-reverted-filter": "Label to toggle filtering on ORES data. 
Parameters:\n* $1 - Action to be performed by toggling.",
-       "ores-reverted-letter": "Single letter for tagging recent changes at 
risk of revert.",
-       "ores-reverted-title": "Tooltip for revert risk icon.",
-       "ores-reverted-legend": "Legend for revert risk icon."
+       "ores-damaging-filter": "Label to toggle filtering on ORES data. 
Parameters:\n* $1 - Action to be performed by toggling.",
+       "ores-damaging-letter": "Single letter for tagging possibly damaging 
recent changes.",
+       "ores-damaging-title": "Tooltip for damaging risk icon.",
+       "ores-damaging-legend": "Legend for damaging risk icon."
 }
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 9239194..389ccb7 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -50,8 +50,8 @@
         * @param $filters
         */
        public static function onChangesListSpecialPageFilters( 
ChangesListSpecialPage $clsp, &$filters ) {
-               $filters['hidenonreverted'] = array(
-                       'msg' => 'ores-reverted-filter',
+               $filters['hidenondamaging'] = array(
+                       'msg' => 'ores-damaging-filter',
                        'default' => false,
                );
 
@@ -73,19 +73,19 @@
                $name, array &$tables, array &$fields, array &$conds,
                array &$query_options, array &$join_conds, FormOptions $opts
        ) {
-               global $wgOresRevertFilterThreshold;
+               global $wgOresDamagingFilterThreshold;
 
                $tables[] = 'ores_classification';
                $fields[] = 'ores_probability';
                $join_conds['ores_classification'] = array( 'LEFT JOIN',
-                       'rc_this_oldid = ores_rev AND ores_model = \'reverted\' 
' .
+                       'rc_this_oldid = ores_rev AND ores_model = \'damaging\' 
' .
                        'AND ores_is_predicted = 1 AND ores_class = \'true\'' );
 
-               if ( $opts->getValue( 'hidenonreverted' ) ) {
+               if ( $opts->getValue( 'hidenondamaging' ) ) {
                        // Filter out non-damaging edits.
                        $conds[] = 'ores_is_predicted = 1';
                        $conds[] = 'ores_probability > '
-                               . wfGetDb( DB_SLAVE )->addQuotes( 
$wgOresRevertFilterThreshold );
+                               . wfGetDb( DB_SLAVE )->addQuotes( 
$wgOresDamagingFilterThreshold );
                }
 
                return true;
@@ -128,10 +128,10 @@
        protected static function processRecentChangesList( RCCacheEntry 
$rcObj, array &$data ) {
                $score = $rcObj->getAttribute( 'ores_probability' );
                if ( $score !== null ) {
-                       $type = Scoring::getRevertThreshold( $score );
+                       $type = Scoring::getDamagingThreshold( $score );
 
                        if ( $type ) {
-                               $data['recentChangesFlags']['revertedRisk'] = 
true;
+                               $data['recentChangesFlags']['damaging'] = true;
                                // TODO: Stash the details in HTML so they can 
be retrieved by JS?
                        }
                }
diff --git a/includes/Scoring.php b/includes/Scoring.php
index e76d4d9..e75abcc 100644
--- a/includes/Scoring.php
+++ b/includes/Scoring.php
@@ -50,15 +50,15 @@
         *
         * TODO: Should be in a model-specific module.
         */
-       public static function getRevertThreshold( $score ) {
-               global $wgOresRevertTagThresholds;
+       public static function getDamagingThreshold( $score ) {
+               global $wgOresDamagingTagThresholds;
 
                $score = floatval( $score );
                $type = null;
 
                // Find the nearest threshold exceeded by $score.
                $highestExceededThreshold = null;
-               foreach ( $wgOresRevertTagThresholds as $name => $threshold ) {
+               foreach ( $wgOresDamagingTagThresholds as $name => $threshold ) 
{
                        if ( $score >= $threshold
                                // Ignore threshold if it's further from $score.
                                && ( $threshold > $highestExceededThreshold || 
$highestExceededThreshold === null )

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8b5ea18ea6618aefd45c53bd8cb52c0005100f50
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Awight <awi...@wikimedia.org>
Gerrit-Reviewer: Awight <awi...@wikimedia.org>
Gerrit-Reviewer: Halfak <ahalfa...@wikimedia.org>
Gerrit-Reviewer: He7d3r <he7...@gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to