Ladsgroup has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/278839

Change subject: Let user make hidenondamaging default
......................................................................

Let user make hidenondamaging default

In recent changes and watchlist

Bug: T130560
Change-Id: Iac1b4b00998ecb3d31e43f1fb3b3142934c11d85
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/Hooks.php
4 files changed, 28 insertions(+), 2 deletions(-)


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

diff --git a/extension.json b/extension.json
index bd0bdc9..3a1a7ed 100644
--- a/extension.json
+++ b/extension.json
@@ -94,7 +94,9 @@
                }
        },
        "DefaultUserOptions": {
-               "oresDamagingPref": "hard"
+               "oresDamagingPref": "hard",
+               "oresRCHideNonDamaging": 0,
+               "oresWatchlistHideNonDamaging": 0
        },
        "manifest_version": 1
 }
diff --git a/i18n/en.json b/i18n/en.json
index df0a8ba..5701080 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -13,5 +13,7 @@
        "ores-damaging-legend": "This edit may be damaging and should be 
reviewed",
        "ores-help-damaging-pref": "This threshold determines how sensitive 
ORES is when flagging edits needing review",
        "ores-pref-damaging": "ORES sensitivity",
+       "ores-pref-rc-hidenondamaging": "Hide good edits from recent changes",
+       "ores-pref-watchlist-hidenondamaging": "Hide good edits from the 
watchlist",
        "prefs-ores" : "ORES"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index b4ffda7..7d98f84 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -16,5 +16,7 @@
        "ores-damaging-legend": "Legend for damaging risk icon.",
        "ores-help-damaging-pref": "Help text for \"ORES sensitivity\" in 
preferences",
        "ores-pref-damaging": "Part asking for damaging threshold",
+       "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",
        "prefs-ores": "{{optional}} \nName of ORES section in preferences"
 }
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 9cea658..1ac9c3c 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -72,9 +72,16 @@
                        return true;
                }
 
+               $default = false;
+               $name = $clsp->getName();
+               if ( $name === 'Watchlist' ) {
+                       $default = $clsp->getUser()->getOption( 
'oresWatchlistHideNonDamaging' );
+               } elseif ( $name === 'Recentchanges' ) {
+                       $default = $clsp->getUser()->getOption( 
'oresRCHideNonDamaging' );
+               }
                $filters['hidenondamaging'] = [
                        'msg' => 'ores-damaging-filter',
-                       'default' => false,
+                       'default' => $default,
                ];
 
                return true;
@@ -253,6 +260,7 @@
 
        /**
         * GetPreferences hook, adding ORES section, letting people choose a 
threshold
+        * Also let people make hidenondamaging default
         */
        public static function onGetPreferences( $user, &$preferences ) {
                global $wgOresDamagingThresholds;
@@ -272,6 +280,18 @@
                        'options' => $options,
                        'help-message' => 'ores-help-damaging-pref',
                ];
+
+               // Make hidenondamaging default
+               $preferences['oresWatchlistHideNonDamaging'] = [
+                       'type' => 'toggle',
+                       'section' => 'watchlist/ores',
+                       'label-message' => 
'ores-pref-watchlist-hidenondamaging',
+               ];
+               $preferences['oresRCHideNonDamaging'] = [
+                       'type' => 'toggle',
+                       'section' => 'rc/advancedrc',
+                       'label-message' => 'ores-pref-rc-hidenondamaging',
+               ];
                return true;
        }
 

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

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

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

Reply via email to