Mattflaschen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/343205 )

Change subject: Add ORES conflicts and What's This?
......................................................................

Add ORES conflicts and What's This?

Bug: T158459
Bug: T156427
Change-Id: Id6a778eb7cdfe8a8c75f2e37631d5226480fa301
---
M i18n/en.json
M i18n/qqq.json
M includes/Hooks.php
3 files changed, 54 insertions(+), 0 deletions(-)


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

diff --git a/i18n/en.json b/i18n/en.json
index 8cdf211..b7c961d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -15,7 +15,15 @@
        "ores-help-damaging-pref": "This threshold determines how sensitive 
ORES is when flagging edits needing review",
        "ores-hide-nondamaging-filter": "Hide probably good edits",
        "ores-pref-damaging": "ORES sensitivity",
+       "ores-rcfilters-whats-this-link-text": "Learn more",
+       "ores-rcfilters-ores-conflicts-logactions-global": "The \"Logged 
actions\" filter is conflicting with one or more \"Contribution quality\" or 
\"User intent\" filters. Quality and Intent predictions are not available for 
logged actions. The conflicting filters are marked as inactive above.",
+       "ores-rcfilters-logactions-conflicts-ores": "This filter is conflicting 
with one or more Contribution Quality or User Intent filters. Quality and 
Intent predictions are not available for logged actions.",
        "ores-rcfilters-damaging-title": "Contribution quality predictions",
+       "ores-rcfilters-damaging-whats-this-header": "About Contribution 
Quality Predictions",
+       "ores-rcfilters-damaging-whats-this-body": "Filter edits based on how 
likely they are to contain problems using predictions made by ORES, a 
machine-learning service trained on a large set of edits previously scored by 
human editors.
+
+Filters with different levels of accuracy are provided. Stricter, more 
accurate filters find fewer false positives but miss more of their targets. 
Less accurate filters find more of their targets, but they also find more false 
positives.",
+       "ores-rcfilters-damaging-conflicts-logactions": "Contribution Quality 
predictions are not available for certain types of change. This filter is 
inactive because it is in conflict with the following Type of Change 
{{PLURAL:$2|filter|filters}}: $1",
        "ores-rcfilters-damaging-likelygood-label": "Very likely good",
        "ores-rcfilters-damaging-likelygood-desc": "Highly accurate at finding 
almost all problem-free edits.",
        "ores-rcfilters-damaging-maybebad-label": "May have problems",
@@ -25,6 +33,11 @@
        "ores-rcfilters-damaging-verylikelybad-label": "Very likely have 
problems",
        "ores-rcfilters-damaging-verylikelybad-desc": "Highly accurate at 
finding the most obvious 10% of flawed or damaging edits.",
        "ores-rcfilters-goodfaith-title": "User intent predictions",
+       "ores-rcfilters-goodfaith-whats-this-header": "About User Intent 
Predictions",
+       "ores-rcfilters-goodfaith-whats-this-body": "Filter edits based on 
whether they were, or weren't, made in good faith using predictions generated 
by ORES, a machine-learning service trained on a large set of edits previously 
scored by human editors.
+
+Filters with different levels of accuracy are provided. Stricter, more 
accurate filters find fewer false positives but miss more of their targets. 
Less accurate filters find more of their targets, but they also find more false 
positives.",
+       "ores-rcfilters-goodfaith-conflicts-logactions": "User Intent 
predictions are not available for certain types of change. This filter is 
inactive because it is in conflict with the following Type of Change 
{{PLURAL:$2|filter|filters}}: $1",
        "ores-rcfilters-goodfaith-good-label": "Very likely good faith",
        "ores-rcfilters-goodfaith-good-desc": "Highly accurate at finding 
almost all good-faith edits.",
        "ores-rcfilters-goodfaith-maybebad-label": "May be bad faith",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 5615b1a..9711a37 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -22,7 +22,13 @@
        "ores-pref-highlight": "Display message for user preference to enable 
highlighting of damaging edits.",
        "ores-pref-rc-hidenondamaging": "Display message for user preferences 
to make hidenondamaging default in recent changes",
        "ores-pref-watchlist-hidenondamaging": "Display message for user 
preferences to make hidenondamaging default in the watchlist",
+       "ores-rcfilters-whats-this-link-text": "Text of a link to more 
information about either Contribution Quality Predictions or User Intent 
Predictions",
+       "ores-rcfilters-ores-conflicts-logactions-global": "Message shown in 
the result area when both an ORES filter and the 'Logged actions' filter are 
selected.  This indicates that no results will be shown because log actions are 
never scored by ORES.\n\n\"Logged actions\" is 
{{msg-mw|rcfilters-filter-logactions-label}}.",
+       "ores-rcfilters-logactions-conflicts-ores": "Tooltip shown when 
hovering over a Logged actions filter tag, when a ORES filter is also 
selected.\n\n\"Logged actions\" is 
{{msg-mw|rcfilters-filter-logactions-label}}.",
        "ores-rcfilters-damaging-title": "Title for the filter group for ORES 
damaging score.",
+       "ores-rcfilters-damaging-whats-this-header": "Header of \"What's This\" 
popup for Contribution Quality group",
+       "ores-rcfilters-damaging-whats-this-body": "Body of \"What's This\" 
popup for Contribution Quality group",
+       "ores-rcfilters-damaging-conflicts-logactions": "Tooltip shown when 
hovering over a 'Contribution quality predictions' filter tag, when the 'Logged 
actions' filter is selected and there is a conflict.  'Logged actions' are not 
scored by ORES.  Parameters:\n* $1 - Comma-separated string of selected Type of 
Change filters, e.g. \"Logged actions\"\n* $2 - Count of selected Type of 
Change filters, for PLURAL",
        "ores-rcfilters-damaging-likelygood-label": "Label for the filter for 
showing edits that are very likely to be non-damaging.",
        "ores-rcfilters-damaging-likelygood-desc": "Description for the filter 
for showing edits that are very likely to be non-damaging.",
        "ores-rcfilters-damaging-maybebad-label": "Label for the filter for 
showing edits that are somewhat likely to be damaging.",
@@ -32,6 +38,9 @@
        "ores-rcfilters-damaging-verylikelybad-label": "Label for the filter 
for showing edits that are somewhat likely to be damaging.",
        "ores-rcfilters-damaging-verylikelybad-desc": "Description for the 
filter for showing edits that are somewhat likely to be damaging.",
        "ores-rcfilters-goodfaith-title": "Title for the filter group for ORES 
good faith score.",
+       "ores-rcfilters-goodfaith-whats-this-header": "Header of \"What's 
This\" popup for User Intent group",
+       "ores-rcfilters-goodfaith-whats-this-body": "Body of \"What's This\" 
popup for User Intent group",
+       "ores-rcfilters-goodfaith-conflicts-logactions": "Tooltip shown when 
hovering over a 'User intent predictions' filter tag, when the 'Logged actions' 
filter is selected and there is a conflict.  'Logged actions' are not scored by 
ORES.  Parameters:\n* $1 - Comma-separated string of selected Type of Change 
filters, e.g. \"Logged actions\"\n* $2 - Count of selected Type of Change 
filters, for PLURAL",
        "ores-rcfilters-goodfaith-good-label": "Label for the filter for 
showing edits that are very likely to be good faith.",
        "ores-rcfilters-goodfaith-good-desc": "Description for the filter for 
showing edits that are very likely to be good faith.",
        "ores-rcfilters-goodfaith-maybebad-label": "Label for the filter for 
showing edits that are somewhat likely to be bad faith.",
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 14149ce..086024b 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -91,11 +91,19 @@
                }
 
                $stats = Stats::newFromGlobalState();
+
+               $changeTypeGroup = $clsp->getFilterGroup( 'changeType' );
+               $logFilter = $changeTypeGroup->getFilter( 'hidelog' );
+
                if ( self::isModelEnabled( 'damaging' ) ) {
                        $damagingLevels = $stats->getThresholds( 'damaging' );
                        $newDamagingGroup = new 
ChangesListStringOptionsFilterGroup( [
                                'name' => 'damaging',
                                'title' => 'ores-rcfilters-damaging-title',
+                               'whatsThisHeader' => 
'ores-rcfilters-damaging-whats-this-header',
+                               'whatsThisBody' => 
'ores-rcfilters-damaging-whats-this-body',
+                               'whatsThisUrl' => 
'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:New_filters_for_edit_review/Quality_and_Intent_Filters',
+                               'whatsThisLinkText' => 
'ores-rcfilters-whats-this-link-text',
                                'priority' => 2,
                                'filters' => [
                                        [
@@ -153,6 +161,14 @@
                                        }
                                },
                        ] );
+
+                       $newDamagingGroup->conflictsWith(
+                               $logFilter,
+                               
'ores-rcfilters-ores-conflicts-logactions-global',
+                               'ores-rcfilters-damaging-conflicts-logactions',
+                               'ores-rcfilters-logactions-conflicts-ores'
+                       );
+
                        $newDamagingGroup->getFilter( 'maybebad' 
)->setAsSupersetOf(
                                $newDamagingGroup->getFilter( 'likelybad' )
                        );
@@ -173,6 +189,9 @@
                                $damagingDefault = false;
                        }
 
+                       // I don't think we need to register a conflict here, 
since
+                       // if we're showing non-damaging, that won't conflict 
with
+                       // anything.
                        $legacyDamagingGroup = new 
ChangesListBooleanFilterGroup( [
                                'name' => 'ores',
                                'filters' => [
@@ -194,6 +213,7 @@
                                ],
 
                        ] );
+
                        $clsp->registerFilterGroup( $legacyDamagingGroup );
                }
                if ( self::isModelEnabled( 'goodfaith' ) ) {
@@ -201,6 +221,10 @@
                        $goodfaithGroup = new 
ChangesListStringOptionsFilterGroup( [
                                'name' => 'goodfaith',
                                'title' => 'ores-rcfilters-goodfaith-title',
+                               'whatsThisHeader' => 
'ores-rcfilters-goodfaith-whats-this-header',
+                               'whatsThisBody' => 
'ores-rcfilters-goodfaith-whats-this-body',
+                               'whatsThisUrl' => 
'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:New_filters_for_edit_review/Quality_and_Intent_Filters',
+                               'whatsThisLinkText' => 
'ores-rcfilters-whats-this-link-text',
                                'priority' => 1,
                                'filters' => [
                                        [
@@ -252,6 +276,14 @@
                        $goodfaithGroup->getFilter( 'maybebadfaith' 
)->setAsSupersetOf(
                                $goodfaithGroup->getFilter( 'bad' )
                        );
+
+                       $goodfaithGroup->conflictsWith(
+                               $logFilter,
+                               
'ores-rcfilters-ores-conflicts-logactions-global',
+                               'ores-rcfilters-goodfaith-conflicts-logactions',
+                               'ores-rcfilters-logactions-conflicts-ores'
+                       );
+
                        $clsp->registerFilterGroup( $goodfaithGroup );
                }
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6a778eb7cdfe8a8c75f2e37631d5226480fa301
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to