jenkins-bot has submitted this change and it was merged.

Change subject: Beta: Allow displaying Related Articles in the footer
......................................................................


Beta: Allow displaying Related Articles in the footer

Even if 'minerva' is blacklisted, show Related Articles in the footer.

See I1663ab25083d9d907f288e60d506831bebb67945.

Bug: T144047
Change-Id: I366c8656a0f14a7069053b2e6199caac20471ea4
---
M includes/MobileFrontend.hooks.php
1 file changed, 19 insertions(+), 0 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified
  Phuedx: Looks good to me, but someone else must approve



diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 56700d0..dd7a7ea 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -176,17 +176,36 @@
         * @see https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageBeforeHTML
         *
         * Applies MobileFormatter to mobile viewed content
+        * Also enables Related Articles in the footer in the beta mode.
         *
         * @param OutputPage $out
         * @param string $text the HTML to be wrapped inside the 
#mw-content-text element
         * @return bool
         */
        public static function onOutputPageBeforeHTML( &$out, &$text ) {
+               global $wgRelatedArticlesFooterBlacklistedSkins;
+
                $context = MobileContext::singleton();
                // Perform a few extra changes if we are in mobile mode
                if ( $context->shouldDisplayMobileView() ) {
                        $text = ExtMobileFrontend::DOMParse( $out, $text, 
$context->isBetaGroupMember() );
                }
+
+               // FIXME: remove the following when RelatedArticles are 
promoted from beta to stable
+               // Configure related articles to be shown in the footer for the 
beta mode
+               // The reason this code is here rather than inside the 
'BeforePageDisplay' hook is
+               // that we want to execute this code before RelatedArticles 
decides not to show
+               // related articles if the skin is blacklisted.
+               if (
+                       ExtensionRegistry::getInstance()->isLoaded( 
'RelatedArticles' ) &&
+                       MobileContext::singleton()->isBetaGroupMember()
+               ) {
+                       $needle = array_search( 'minerva', 
$wgRelatedArticlesFooterBlacklistedSkins ?: [] );
+                       if ( $needle !== false ) {
+                               array_splice( 
$wgRelatedArticlesFooterBlacklistedSkins, $needle, 1 );
+                       }
+               }
+
                return true;
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I366c8656a0f14a7069053b2e6199caac20471ea4
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <bmansu...@wikimedia.org>
Gerrit-Reviewer: Bmansurov <bmansu...@wikimedia.org>
Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Phuedx <g...@samsmith.io>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to