Jforrester has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/354729 )
Change subject: Drop all trace of the Beta Features integration ...................................................................... Drop all trace of the Beta Features integration This includes dropping the 'OresExtensionStatus' config setting (it's now always true; if you don't want the extension to operate on a wiki, please don't install it there). Change-Id: I9d593f99a2987f90dc2abbdd13c4dd98409b90e8 --- M extension.json M i18n/en.json M i18n/qqq.json D images/ORES-beta-features-ltr.svg D images/ORES-beta-features-rtl.svg M includes/Hooks.php M tests/phpunit/includes/HooksTest.php 7 files changed, 20 insertions(+), 211 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES refs/changes/29/354729/1 diff --git a/extension.json b/extension.json index 6cd88a2..72d6428 100644 --- a/extension.json +++ b/extension.json @@ -63,9 +63,6 @@ "EnhancedChangesListModifyLineData": [ "ORES\\Hooks::onEnhancedChangesListModifyLineData" ], - "GetBetaFeaturePreferences": [ - "ORES\\Hooks::onGetBetaFeaturePreferences" - ], "GetPreferences": [ "ORES\\Hooks::onGetPreferences" ], @@ -121,7 +118,6 @@ "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 f051aa0..c2daa5a 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -2,8 +2,6 @@ "@metadata": { "authors": [] }, - "ores-beta-feature-description": "ORES is an AI-based tool that highlights probably damaging edits in recent changes and watchlist.", - "ores-beta-feature-message": "ORES", "ores-desc": "Expose automated revision scores in the interface", "ores-damaging-filter": "$1 probably good edits", "ores-damaging-letter": "r", diff --git a/i18n/qqq.json b/i18n/qqq.json index bb65610..f9ecdc6 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -8,8 +8,6 @@ "Liuxinyu970226" ] }, - "ores-beta-feature-description": "Description of ORES in beta features page.", - "ores-beta-feature-message": "Title of ORES section in beta features page.", "ores-desc": "{{desc|name=ORES|url=https://www.mediawiki.org/wiki/Extension:ORES}}", "ores-damaging-filter": "Label to toggle filtering on ORES data. Parameters:\n* $1 - Action to be performed by toggling. Can be either 'show' or 'hide'.", "ores-damaging-letter": "Single letter for tagging possibly damaging recent changes.", diff --git a/images/ORES-beta-features-ltr.svg b/images/ORES-beta-features-ltr.svg deleted file mode 100644 index c4adef1..0000000 --- a/images/ORES-beta-features-ltr.svg +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="264" height="162" viewBox="0 0 264 162" id="svg2"> - <defs id="defs78"> - <clipPath id="jagged-edge"> - <path id="path5050" d="M0 0v152l12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10V0z"/> - </clipPath> - </defs> - <g id="screenshot" clip-path="url(#jagged-edge)"> - <path fill="#fff" d="M263.5 162.25l-263-.5V.5h263z" id="background"/> - <path fill="#e5e5e5" d="M252 162.496V29H48v133.496z" id="article"/> - <path fill="#e5e5e5" d="M11 22c0-7.732 6.268-14 14-14s14 6.268 14 14-6.268 14-14 14-14-6.268-14-14z" id="logo"/> - <path fill="#e5e5e5" d="M38 163.807V58H13v105.807h25z" id="sidebar"/> - <g fill="#e5e5e5" id="personal-tools"> - <path id="path5058" d="M233 5h26v6h-26V5zm-24 0h22v6h-22zm-24 0h22v6h-22zm-23 0h13v6h-13zm15 0h6v6h-6zm-23 0h6v6h-6z"/> - </g> - <g fill="#e5e5e5" id="search"> - <path d="M258 16v4h-92v-4h92m1-1h-94v6h94v-6z" id="path5717"/> - <path d="M168 17h2v2h-2z" id="icon"/> - </g> - <path fill="#e5e5e5" d="M38 45v-5H13v5h25z" id="sitename"/> - <path fill="#e5e5e5" id="border" d="M0 0v162h264V0zm1 1h262v150.533l-11 9.166-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-12-10-12 10-11-9.168z"/> - <path d="M65 72h175v15H65z" id="rect4817" fill="#36c"/> - <path d="M62 48h26v6H62z" id="rect4728" fill="#999"/> - <g id="g4801" fill="#999"> - <path d="M72.582 62.304q-.57.976-.845 1.932-.276.955-.276 1.936 0 .98.278 1.945.28.96.845 1.932h-.68q-.636-1-.954-1.964-.316-.964-.316-1.915 0-.946.315-1.905.313-.96.954-1.962h.68z" id="path4735"/> - <path d="M104.918 62.304h.68q.636 1.002.95 1.962.32.96.32 1.906 0 .95-.32 1.915-.314.964-.95 1.962h-.68q.565-.974.84-1.934.28-.964.28-1.945 0-.98-.28-1.935-.275-.956-.84-1.932z" id="path4739"/> - <path d="M88 63h1v6h-1z" id="rect4752"/> - <path d="M75 64h10v4H75z" id="rect4754"/> - <rect overflow="visible" ry=".107" rx=".166" y="64" x="92" height="4" width="11" id="rect4754-3" style="isolation:auto;mix-blend-mode:normal" color="#000" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"/> - <path d="M110 64h125v4H110z" id="rect4754-3-6"/> - </g> - <path d="M62 127h26v6H62z" id="rect4728-7" fill="#999"/> - <use xlink:href="#g4801" id="use4809" width="100%" height="100%" transform="translate(0 28)"/> - <use xlink:href="#g4801" id="use4813" transform="translate(0 42)" width="100%" height="100%"/> - <use xlink:href="#g4801" id="use4815" transform="translate(0 14)" width="100%" height="100%" fill="#fff"/> - <use xlink:href="#g4801" id="use4927" transform="translate(0 78)" width="100%" height="100%"/> - </g> -</svg> diff --git a/images/ORES-beta-features-rtl.svg b/images/ORES-beta-features-rtl.svg deleted file mode 100644 index 692b409..0000000 --- a/images/ORES-beta-features-rtl.svg +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="264" height="162" viewBox="0 0 264 162" id="svg2"> - <defs id="defs78"> - <clipPath id="jagged-edge"> - <path id="path4141" d="M0 0v152l12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10V0z"/> - </clipPath> - </defs> - <g id="screenshot" clip-path="url(#jagged-edge)"> - <path d="M.5 162.25l263-.5V.5H.5z" id="background" fill="#fff"/> - <path d="M12 162.496V29h204v133.496z" id="article" fill="#e5e5e5"/> - <path d="M253 22c0-7.732-6.268-14-14-14s-14 6.268-14 14 6.268 14 14 14 14-6.268 14-14z" id="logo" fill="#e5e5e5"/> - <path d="M226 163.807V58h25v105.807h-25z" id="sidebar" fill="#e5e5e5"/> - <g id="personal-tools" fill="#e5e5e5"> - <path id="path4149" transform="matrix(-1 0 0 1 264 0)" d="M233 5h26v6h-26V5zm-24 0h22v6h-22zm-24 0h22v6h-22zm-23 0h13v6h-13zm15 0h6v6h-6zm-23 0h6v6h-6z"/> - </g> - <g id="search" fill="#e5e5e5"> - <path transform="matrix(-1 0 0 1 264 0)" d="M258 16v4h-92v-4h92m1-1h-94v6h94v-6z" id="path5717"/> - <path transform="matrix(-1 0 0 1 264 0)" d="M168 17h2v2h-2z" id="icon"/> - </g> - <path d="M226 45v-5h25v5h-25z" id="sitename" fill="#e5e5e5"/> - <path id="border" d="M264 0v162H0V0zm-1 1H1v150.533l11 9.166 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 12-10 12 10 11-9.168z" fill="#e5e5e5"/> - <path transform="scale(-1 1)" id="rect4817" fill="#36c" d="M-199 72h175v15h-175z"/> - <path transform="scale(-1 1)" id="rect4728" fill="#999" d="M-202 48h26v6h-26z"/> - <g id="g4801" transform="matrix(-1 0 0 1 264 0)" fill="#999"> - <path id="path4735" d="M72.582 62.304q-.57.976-.845 1.932-.276.955-.276 1.936 0 .98.277 1.945.28.96.845 1.932h-.68q-.636-1-.954-1.963-.315-.964-.315-1.915 0-.947.315-1.906.314-.96.955-1.962h.68z"/> - <path id="path4739" d="M104.918 62.304h.68q.636 1.002.95 1.962.32.96.32 1.906 0 .95-.32 1.915-.314.964-.95 1.962h-.68q.565-.973.84-1.933.28-.964.28-1.945 0-.98-.28-1.936-.275-.956-.84-1.932z"/> - <path id="rect4752" d="M88 63h1v6h-1z"/> - <path id="rect4754" d="M75 64h10v4H75z"/> - <rect style="isolation:auto;mix-blend-mode:normal" id="rect4754-3" width="11" height="4" x="92" y="64" rx=".166" ry=".107" color="#000" overflow="visible" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"/> - <path id="rect4754-3-6" d="M110 64h125v4H110z"/> - </g> - <path transform="scale(-1 1)" id="rect4728-7" fill="#999" d="M-202 127h26v6h-26z"/> - <use transform="translate(0 28)" height="100%" width="100%" id="use4809" xlink:href="#g4801"/> - <use height="100%" width="100%" transform="translate(0 42)" id="use4813" xlink:href="#g4801"/> - <use height="100%" width="100%" transform="translate(0 14)" id="use4815" xlink:href="#g4801" fill="#fff"/> - <use height="100%" width="100%" transform="translate(0 78)" id="use4927" xlink:href="#g4801"/> - </g> -</svg> diff --git a/includes/Hooks.php b/includes/Hooks.php index 295b9bf..207553d 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -2,7 +2,6 @@ namespace ORES; -use BetaFeatures; use ChangesList; use ChangesListBooleanFilterGroup; use ChangesListFilterGroup; @@ -93,7 +92,7 @@ ChangesListSpecialPage $clsp ) { // ORES is disabled on Recentchangeslinked: T163063 - if ( !self::oresEnabled( $clsp->getUser() ) || $clsp->getName() === 'Recentchangeslinked' ) { + if ( $clsp->getName() === 'Recentchangeslinked' ) { return; } @@ -356,10 +355,8 @@ $name, array &$tables, array &$fields, array &$conds, array &$query_options, array &$join_conds, FormOptions $opts ) { - global $wgUser; - // ORES is disabled on Recentchangeslinked: T163063 - if ( !self::oresEnabled( $wgUser ) || $name === 'Recentchangeslinked' ) { + if ( $name === 'Recentchangeslinked' ) { return; } @@ -399,10 +396,6 @@ RCCacheEntry $rcObj, array &$classes ) { - if ( !self::oresEnabled( $ecl->getUser() ) ) { - return; - } - self::processRecentChangesList( $rcObj, $data, $classes, $ecl->getContext() ); } @@ -418,10 +411,6 @@ array &$data, RCCacheEntry $rcObj ) { - if ( !self::oresEnabled( $ecl->getUser() ) ) { - return; - } - $classes = []; self::processRecentChangesList( $rcObj, $data, $classes, $ecl->getContext() ); } @@ -441,10 +430,6 @@ $rc, &$classes = [] ) { - if ( !self::oresEnabled( $changesList->getUser() ) ) { - return; - } - $damaging = self::getScoreRecentChangesList( $rc, $changesList->getContext() ); if ( $damaging ) { // Add highlight class @@ -480,10 +465,6 @@ ContribsPager $pager, &$query ) { - if ( !self::oresEnabled( $pager->getUser() ) ) { - return; - } - if ( self::isModelEnabled( 'damaging' ) ) { $request = $pager->getContext()->getRequest(); @@ -509,10 +490,6 @@ $row, array &$flags ) { - if ( !self::oresEnabled( $context->getUser() ) ) { - return; - } - // Doesn't have ores score, skipping. if ( !isset( $row->ores_damaging_score ) ) { return; @@ -535,10 +512,6 @@ $row, array &$classes ) { - if ( !self::oresEnabled( $pager->getUser() ) ) { - return; - } - // Doesn't have ores score or threshold is not set properly, skipping. if ( !isset( $row->ores_damaging_score ) || !isset( $row->ores_damaging_threshold ) ) { return; @@ -564,7 +537,7 @@ SpecialContributions $page, array &$filters ) { - if ( !self::oresEnabled( $page->getUser() ) || !self::isModelEnabled( 'damaging' ) ) { + if ( !self::isModelEnabled( 'damaging' ) ) { return; } @@ -663,9 +636,9 @@ * @param string[] $preferences */ public static function onGetPreferences( User $user, array &$preferences ) { - global $wgOresFiltersThresholds, $wgOresExtensionStatus, $wgHiddenPrefs; + global $wgOresFiltersThresholds, $wgHiddenPrefs; - if ( !self::oresEnabled( $user ) || !self::isModelEnabled( 'damaging' ) ) { + if ( !self::isModelEnabled( 'damaging' ) ) { return; } @@ -684,30 +657,28 @@ $options[ $text ] = $prefName; } } - $oresSection = $wgOresExtensionStatus === 'beta' ? 'rc/ores' : 'watchlist/ores'; + $preferences['oresDamagingPref'] = [ 'type' => 'select', 'label-message' => 'ores-pref-damaging', - 'section' => $oresSection, + 'section' => 'watchlist/ores', 'options' => $options, 'help-message' => 'ores-help-damaging-pref', ]; - if ( $wgOresExtensionStatus !== 'beta' ) { - // highlight damaging edits based on configured sensitivity - $preferences['oresHighlight'] = [ - 'type' => 'toggle', - 'section' => $oresSection, - 'label-message' => 'ores-pref-highlight', - ]; + // highlight damaging edits based on configured sensitivity + $preferences['oresHighlight'] = [ + 'type' => 'toggle', + 'section' => $oresSection, + 'label-message' => 'ores-pref-highlight', + ]; - // Control whether the "r" appears on RC - $preferences['ores-damaging-flag-rc'] = [ - 'type' => 'toggle', - 'section' => 'rc/advancedrc', - 'label-message' => 'ores-pref-damaging-flag', - ]; - } + // Control whether the "r" appears on RC + $preferences['ores-damaging-flag-rc'] = [ + 'type' => 'toggle', + 'section' => 'rc/advancedrc', + 'label-message' => 'ores-pref-damaging-flag', + ]; // Make hidenondamaging default $preferences['oresWatchlistHideNonDamaging'] = [ @@ -737,10 +708,6 @@ * @param Skin $skin */ public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) { - if ( !self::oresEnabled( $out->getUser() ) ) { - return; - } - $oresData = $out->getProperty( 'oresData' ); if ( $oresData !== null ) { @@ -767,54 +734,6 @@ } /** - * Make a beta feature - * - * @param User $user - * @param string[] &$prefs - */ - public static function onGetBetaFeaturePreferences( User $user, array &$prefs ) { - global $wgOresExtensionStatus, $wgExtensionAssetsPath; - - 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 ores is enabled - * - * @param User $user - * @return bool - */ - private static function oresEnabled( User $user ) { - global $wgOresExtensionStatus; - - // enabled by default for everybody - if ( $wgOresExtensionStatus === 'on' ) { - return true; - } - - // 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; - } - - /** * @param IContextSource $context * @return boolean Whether $context->getTitle() is a RecentChanges page */ @@ -838,10 +757,9 @@ * @return boolean Whether the damaging flag ("r") should be shown */ private static function isDamagingFlagEnabled( IContextSource $context ) { - global $wgOresExtensionStatus; $isRCPage = self::isRCPage( $context ); $user = $context->getUser(); - return $wgOresExtensionStatus === 'beta' || + return ( $isRCPage && $user->getBoolOption( 'ores-damaging-flag-rc' ) && diff --git a/tests/phpunit/includes/HooksTest.php b/tests/phpunit/includes/HooksTest.php index 21c52d0..0ecd196 100644 --- a/tests/phpunit/includes/HooksTest.php +++ b/tests/phpunit/includes/HooksTest.php @@ -551,31 +551,6 @@ $this->assertSame( 5, count( $prefs ) ); } - public function testOnGetBetaFeaturePreferences_on() { - $this->setMwGlobals( 'wgOresExtensionStatus', 'on' ); - $prefs = []; - ORES\Hooks::onGetBetaFeaturePreferences( $this->user, $prefs ); - - $this->assertSame( 0, count( $prefs ) ); - } - - public function testOnGetBetaFeaturePreferences_off() { - $this->setMwGlobals( 'wgOresExtensionStatus', 'off' ); - $prefs = []; - ORES\Hooks::onGetBetaFeaturePreferences( $this->user, $prefs ); - - $this->assertSame( 0, count( $prefs ) ); - } - - public function testOnGetBetaFeaturePreferences_beta() { - $this->setMwGlobals( 'wgOresExtensionStatus', 'beta' ); - $prefs = []; - ORES\Hooks::onGetBetaFeaturePreferences( $this->user, $prefs ); - - $this->assertSame( 1, count( $prefs ) ); - $this->assertArrayHasKey( 'ores-enabled', $prefs ); - } - /** * @param User $user * -- To view, visit https://gerrit.wikimedia.org/r/354729 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9d593f99a2987f90dc2abbdd13c4dd98409b90e8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ORES Gerrit-Branch: master Gerrit-Owner: Jforrester <jforres...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits