From 8f1f7f209566f5a93551376b0bc332c7eb0f1f1f Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Wed, 5 May 2021 14:28:38 +0200 Subject: [PATCH] Enable Reference Previews for more users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Registered users see reference previews by default, and anonymous users by default when not in beta feature mode. Cherry-picked from I28c43ab3348ffdc27b068fc1ac1d6a6a06ee90a6 and 1fce62ca7b3f3f01b3a3b2bcea220a9a99a2a794. The behavior for PagePreviews – implemented years ago – was different. For old users it was disabled by default. This behavior is wrong for ReferencePreviews. Bug: T271206 Change-Id: I28c43ab3348ffdc27b068fc1ac1d6a6a06ee90a6 --- includes/PopupsContext.php | 6 ++++++ includes/PopupsHooks.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/PopupsContext.php b/includes/PopupsContext.php index 699d406f9..dde08509a 100644 --- a/includes/PopupsContext.php +++ b/includes/PopupsContext.php @@ -158,6 +158,12 @@ class PopupsContext { self::REFERENCE_PREVIEWS_PREFERENCE_NAME ); } + + // if not in Beta then enable for anonymous users + if ( $user->isAnon() ) { + return true; + } + return $user->getBoolOption( self::REFERENCE_PREVIEWS_PREFERENCE_NAME_AFTER_BETA ); } diff --git a/includes/PopupsHooks.php b/includes/PopupsHooks.php index f96d871b8..06f30c361 100644 --- a/includes/PopupsHooks.php +++ b/includes/PopupsHooks.php @@ -224,7 +224,7 @@ class PopupsHooks { if ( $config->get( 'PopupsReferencePreviews' ) && !$config->get( 'PopupsReferencePreviewsBetaFeature' ) ) { - $defaultOptions[PopupsContext::REFERENCE_PREVIEWS_PREFERENCE_NAME_AFTER_BETA] = $default; + $defaultOptions[PopupsContext::REFERENCE_PREVIEWS_PREFERENCE_NAME_AFTER_BETA] = '1'; } }