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

Change subject: RCFilters: hide ores highlight and "r" on watchlist beta
......................................................................

RCFilters: hide ores highlight and "r" on watchlist beta

When the structured filters UI is enabled watchlist via
the beta feature, elements of classic ORES should not
be shown. Previously set preferences for watchlist
are still in effect for the regular page but not
the beta version.

Change-Id: Ice2489da97997837b4dff49233d8398925221864
Depends-On: I1cb402559edb242b40a77f509480560f0636264d
Bug: T174725
---
M includes/Hooks.php
1 file changed, 29 insertions(+), 14 deletions(-)


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

diff --git a/includes/Hooks.php b/includes/Hooks.php
index eb8b3c0..bc3d8ec 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -783,7 +783,15 @@
        }
 
        /**
-        * @param IContextSource $title
+        * @param IContextSource $context
+        * @return bool Whether $context->getTitle() is the Watchlist page
+        */
+       private static function isWLPage( IContextSource $context ) {
+               return $context->getTitle()->isSpecial( 'Watchlist' );
+       }
+
+       /**
+        * @param IContextSource $context
         * @return bool Whether highlights should be shown
         */
        private static function isHighlightEnabled( IContextSource $context ) {
@@ -797,20 +805,27 @@
         * @return bool 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' ||
-                       (
-                               $isRCPage &&
-                               $user->getBoolOption( 'ores-damaging-flag-rc' ) 
&&
-                               // If rcenhancedfilters is enabled, the 
ores-damaging-flag-rc preference is hidden,
-                               // but it doesn't behave as if it's false; see 
HACK comment in onGetPreferences
-                               !$user->getBoolOption( 'rcenhancedfilters' )
-                       ) || (
-                               !$isRCPage &&
-                               $user->getBoolOption( 'oresHighlight' )
-                       );
+
+               if ( !self::oresUiEnabled( $user ) ) {
+                       return false;
+               }
+
+               if ( self::isRCPage( $context ) ) {
+                       $page = new SpecialRecentChanges();
+                       $page->setContext( $context );
+                       return !$page->isStructuredFilterUiEnabled() &&
+                               $user->getBoolOption( 'ores-damaging-flag-rc' );
+               }
+
+               if ( self::isWLPage( $context ) ) {
+                       $page = new SpecialWatchlist();
+                       $page->setContext( $context );
+                       return !$page->isStructuredFilterUiEnabled() &&
+                               $user->getBoolOption( 'oresHighlight' );
+               }
+
+               return $user->getBoolOption( 'oresHighlight' );
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice2489da97997837b4dff49233d8398925221864
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Sbisson <sbis...@wikimedia.org>

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

Reply via email to