Sbisson has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342643 )
Change subject: Allow the ORES extension features to be 'on' by default
......................................................................
Allow the ORES extension features to be 'on' by default
Introducing $wgOresExtensionStatus, it takes the following values
'on': all ORES extension features are turned on
'beta': (same as current behavior) it adds the beta feature which
can be enabled by individual users
<anything else>: means it is turned off
Rephrased 'hide probably good edits from rc|watchlist' preferenced
as per the ticket.
Added new preference to control highlighting of potentially damaging edits.
Moved 'oresWatchlistHideNonDamaging' preference to
'watchlist/advancedwatchlist' section.
Bug: T159763
Change-Id: I63b11eff3a4a2f41e38b1a5ea8daaeb4db60a51c
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/Hooks.php
M modules/ext.ores.styles.css
5 files changed, 53 insertions(+), 20 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES
refs/changes/43/342643/1
diff --git a/extension.json b/extension.json
index d0336f0..d3fcd13 100644
--- a/extension.json
+++ b/extension.json
@@ -100,6 +100,7 @@
"ORESFetchScoreJob": "ORES\\FetchScoreJob"
},
"config": {
+ "OresExtensionStatus": "on",
"OresBaseUrl": "https://ores.wikimedia.org/",
"OresExcludeBots": true,
"OresModels": {
diff --git a/i18n/en.json b/i18n/en.json
index d9e9dbf..c3e4692 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -15,8 +15,9 @@
"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-pref-rc-hidenondamaging": "Hide probably good edits from recent
changes",
- "ores-pref-watchlist-hidenondamaging": "Hide probably good edits from
the watchlist",
+ "ores-pref-highlight": "Highlight probably damaging edits",
+ "ores-pref-rc-hidenondamaging": "Show only edits that may have problems
(and hide probably good edits) in recent changes",
+ "ores-pref-watchlist-hidenondamaging": "Show only edits that may have
problems (and hide probably good edits) in the watchlist",
"prefs-ores" : "Revision scoring",
"apihelp-query+ores-description": "Return ORES configuration and model
data for this wiki.",
"apihelp-query+ores-example-simple": "Fetch ORES data:",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index a7c63ba..5f5ede0 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -19,6 +19,7 @@
"ores-help-damaging-pref": "Help text for \"ORES sensitivity\" in
preferences",
"ores-hide-nondamaging-filter": "Label for Contributions filter, 'only
show'",
"ores-pref-damaging": "Part asking for damaging threshold",
+ "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",
"prefs-ores": "Name of ORES section in preferences",
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 09e3916..015c3a3 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -267,6 +267,9 @@
}
$classes[] = 'damaging';
+ if ( $changesList->getUser()->getBoolOption(
'oresHighlight' ) ) {
+ $classes[] = 'ores-highlight';
+ }
$parts = explode( $separator, $s );
$parts[1] = ChangesList::flag( 'damaging' ) . $parts[1];
$s = implode( $separator, $parts );
@@ -353,6 +356,9 @@
if ( $row->ores_damaging_score > $row->ores_damaging_threshold
) {
// Add the damaging class
$classes[] = 'damaging';
+ if ( $pager->getUser()->getBoolOption( 'oresHighlight'
) ) {
+ $classes[] = 'ores-highlight';
+ }
}
}
@@ -400,6 +406,9 @@
$damaging = self::getScoreRecentChangesList( $rcObj, $context );
if ( $damaging ) {
$classes[] = 'damaging';
+ if ( $context->getUser()->getBoolOption(
'oresHighlight' ) ) {
+ $classes[] = 'ores-highlight';
+ }
$data['recentChangesFlags']['damaging'] = true;
}
@@ -481,10 +490,17 @@
'help-message' => 'ores-help-damaging-pref',
];
+ // highlight damaging edits based on configured sensitivity
+ $preferences['oresHighlight'] = [
+ 'type' => 'toggle',
+ 'section' => 'rc/ores',
+ 'label-message' => 'ores-pref-highlight',
+ ];
+
// Make hidenondamaging default
$preferences['oresWatchlistHideNonDamaging'] = [
'type' => 'toggle',
- 'section' => 'watchlist/ores',
+ 'section' => 'watchlist/advancedwatchlist',
'label-message' =>
'ores-pref-watchlist-hidenondamaging',
];
$preferences['oresRCHideNonDamaging'] = [
@@ -526,31 +542,45 @@
* @param string[] &$prefs
*/
public static function onGetBetaFeaturePreferences( User $user, array
&$prefs ) {
- global $wgExtensionAssetsPath;
+ global $wgOresExtensionStatus, $wgExtensionAssetsPath;
- $prefs['ores-enabled'] = [
- 'label-message' => 'ores-beta-feature-message',
- 'desc-message' => 'ores-beta-feature-description',
- 'screenshot' => [
- 'ltr' =>
"$wgExtensionAssetsPath/ORES/images/ORES-beta-features-ltr.svg",
- 'rtl' =>
"$wgExtensionAssetsPath/ORES/images/ORES-beta-features-rtl.svg",
- ],
- 'info-link' =>
'https://www.mediawiki.org/wiki/ORES_review_tool',
- 'discussion-link' =>
'https://www.mediawiki.org/wiki/Talk:ORES_review_tool',
- ];
+ if ( $wgOresExtensionStatus === 'beta' ) {
+ $prefs['ores-enabled'] = [
+ 'label-message' => 'ores-beta-feature-message',
+ 'desc-message' =>
'ores-beta-feature-description',
+ 'screenshot' => [
+ 'ltr' =>
"$wgExtensionAssetsPath/ORES/images/ORES-beta-features-ltr.svg",
+ 'rtl' =>
"$wgExtensionAssetsPath/ORES/images/ORES-beta-features-rtl.svg",
+ ],
+ 'info-link' =>
'https://www.mediawiki.org/wiki/ORES_review_tool',
+ 'discussion-link' =>
'https://www.mediawiki.org/wiki/Talk:ORES_review_tool',
+ ];
+ }
}
/**
- * Check whether the user enabled ores as a beta feature
+ * Check whether ores is enabled
*
* @param User $user
* @return bool
*/
private static function oresEnabled( User $user ) {
- if ( !class_exists( 'BetaFeatures' ) ) {
- return false;
+ global $wgOresExtensionStatus;
+
+ // enabled by default for everybody
+ if ( $wgOresExtensionStatus === 'on' ) {
+ return true;
}
- return BetaFeatures::isFeatureEnabled( $user, 'ores-enabled' );
+
+ // exists as a beta feature, enabled by $user
+ if ( $wgOresExtensionStatus === 'beta' ) {
+ return $user &&
+ $user->isLoggedIn() &&
+ class_exists( 'BetaFeatures' ) &&
+ BetaFeatures::isFeatureEnabled( $user,
'ores-enabled' );
+ }
+
+ return false;
}
/**
diff --git a/modules/ext.ores.styles.css b/modules/ext.ores.styles.css
index acb7ce5..4bbc11b 100644
--- a/modules/ext.ores.styles.css
+++ b/modules/ext.ores.styles.css
@@ -9,8 +9,8 @@
/**
* Make the whole row orange
*/
-li.damaging,
-tr.damaging {
+li.damaging.ores-highlight,
+tr.damaging.ores-highlight {
background: #fef6e7;
line-height: 1.8;
}
--
To view, visit https://gerrit.wikimedia.org/r/342643
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I63b11eff3a4a2f41e38b1a5ea8daaeb4db60a51c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Sbisson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits