[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Beta: Allow displaying Related Articles in the footer

2016-09-22 Thread jenkins-bot (Code Review)
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 
Gerrit-Reviewer: Bmansurov 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: Phuedx 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Beta: Allow displaying Related Articles in the footer

2016-09-16 Thread Bmansurov (Code Review)
Bmansurov has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311195

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.

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/95/311195/1

diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 56700d0..0c82c8a 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -148,13 +148,28 @@
 * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateOutputPageBeforeExec
 *
 * Adds a link to view the current page in 'mobile view' to the desktop 
footer.
+* Also enables Related Articles in the footer in the beta mode.
 *
 * @param SkinTemplate $skin
 * @param QuickTemplate $tpl
 * @return bool
 */
public static function onSkinTemplateOutputPageBeforeExec( &$skin, 
&$tpl ) {
+   global $wgRelatedArticlesFooterBlacklistedSkins, 
$wgRelatedArticlesShowInFooter;
+
MobileFrontendSkinHooks::prepareFooter( $skin, $tpl );
+
+   // Configure related articles to be shown in the footer for the 
beta mode
+   if (
+   ExtensionRegistry::getInstance()->isLoaded( 
'RelatedArticles' ) &&
+   MobileContext::singleton()->isBetaGroupMember()
+   ) {
+   $wgRelatedArticlesShowInFooter = true;
+   if ( in_array( 'minerva', 
$wgRelatedArticlesFooterBlacklistedSkins ?: [] ) ) {
+   unset( 
$wgRelatedArticlesFooterBlacklistedSkins[ 'minerva' ] );
+   }
+   }
+
return true;
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I366c8656a0f14a7069053b2e6199caac20471ea4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov 

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