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

Change subject: Hack around the fact that setting $wgHiddenPrefs from 
GetPreferences doesn't fully work
......................................................................

Hack around the fact that setting $wgHiddenPrefs from GetPreferences doesn't 
fully work

We should consider fixing this properly by setting it somewhere else,
but for now just changing the one place where this preference is
used will work around the bug.

Bug: T163712
Change-Id: I336a782680c45ef77a608f345f179be998470509
(cherry picked from commit 2b6893320831574a12e1bc44935289075cda8b08)
---
M includes/Hooks.php
1 file changed, 12 insertions(+), 4 deletions(-)


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

diff --git a/includes/Hooks.php b/includes/Hooks.php
index 90e1fec..993ca51 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -644,6 +644,9 @@
                ];
                // Hide RC prefs if enhanced filters are enabled
                if ( $user->getBoolOption( 'rcenhancedfilters' ) ) {
+                       // HACK: Note that this only hides the preferences on 
the preferences page,
+                       // it does not cause them to behave as if they're set 
to their default value,
+                       // because this hook only runs on the preferences page.
                        $wgHiddenPrefs[] = 'oresRCHideNonDamaging';
                        $wgHiddenPrefs[] = 'ores-damaging-flag-rc';
                }
@@ -750,10 +753,15 @@
        private static function isDamagingFlagEnabled( IContextSource $context 
) {
                global $wgOresExtensionStatus;
                return $wgOresExtensionStatus === 'beta' ||
-                       $context->getUser()->getBoolOption(
-                               self::isRCPage( $context ) ?
-                                       'ores-damaging-flag-rc' :
-                                       'oresHighlight'
+                       (
+                               self::isRCPage( $context ) &&
+                               $context->getUser()->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
+                               !$context->getUser()->getBoolOption( 
'rcenhancedfilters' )
+                       ) || (
+                               !self::isRCPage( $context ) &&
+                               $context->getUser()->getBoolOption( 
'oresHighlight' )
                        );
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I336a782680c45ef77a608f345f179be998470509
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: wmf/1.29.0-wmf.20
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>

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

Reply via email to