[MediaWiki-commits] [Gerrit] mediawiki...RelatedArticles[master]: Breaking change: Remove Sidebar code from RelatedArticles

2017-08-10 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/355637 )

Change subject: Breaking change: Remove Sidebar code from RelatedArticles
..


Breaking change: Remove Sidebar code from RelatedArticles

RelatedArticles will now only render related articles in the footer of
skins.

Bump version to 3.0.0

Bug: T165991
Change-Id: Ia4e28c0ed76b3aff37c0aea8eb713923312ba23c
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/FooterHooks.php
D includes/SidebarHooks.php
M tests/browser/LocalSettings.php
6 files changed, 2 insertions(+), 134 deletions(-)

Approvals:
  Pmiazga: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/extension.json b/extension.json
index 34e4872..21f4c85 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
"name": "RelatedArticles",
-   "version": "2.1.0",
+   "version": "3.0.0",
"author": [
"Roland Unger",
"Hans Musil",
@@ -14,7 +14,6 @@
"AutoloadClasses": {
"RelatedArticles\\ResourceLoaderMuHoganModule": 
"includes/ResourceLoaderMuhoganModule.php",
"RelatedArticles\\Hooks": "includes/Hooks.php",
-   "RelatedArticles\\SidebarHooks": "includes/SidebarHooks.php",
"RelatedArticles\\FooterHooks": "includes/FooterHooks.php"
},
"ExtensionMessagesFiles": {
@@ -30,10 +29,6 @@
],
"OutputPageParserOutput": [
"RelatedArticles\\Hooks::onOutputPageParserOutput"
-   ],
-
-   "SidebarBeforeOutput": [
-   "RelatedArticles\\SidebarHooks::onSidebarBeforeOutput"
],
 
"MakeGlobalVariablesScript": [
@@ -164,8 +159,6 @@
"config": {
"@RelatedArticlesCardLimit": "Maximum number of articles that 
should be shown in RelatedArticles widget. This limit is derived from limits in 
TextExtracts and PageImages extensions. Number should be between 1 and 20.",
"RelatedArticlesCardLimit": 3,
-   "RelatedArticlesShowInSidebar": true,
-   "RelatedArticlesShowInFooter": false,
"RelatedArticlesUseCirrusSearch": false,
"RelatedArticlesOnlyUseCirrusSearch": false,
"RelatedArticlesLoggingBucketSize": 0.01,
diff --git a/i18n/en.json b/i18n/en.json
index 58a3897..bf94bc7 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -2,7 +2,6 @@
"@metadata": {
"authors": []
},
-   "relatedarticles-title": "Related pages",
"relatedarticles-desc": "Adds a link to related pages on the sidebar or 
in the footer, if the user enables the beta feature.",
"relatedarticles-read-more-heading": "Related pages"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 9c37aeb..0b22f7f 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -7,7 +7,6 @@
"Robby"
]
},
-   "relatedarticles-title": "Title shown on the sidebar",
"relatedarticles-desc": "{{desc|name=Related 
Articles|url=https://www.mediawiki.org/wiki/Extension:RelatedArticles}};,
"relatedarticles-read-more-heading": "The heading of section, added at 
the end of the page, that lists the related pages"
 }
diff --git a/includes/FooterHooks.php b/includes/FooterHooks.php
index f43e8cc..64559af 100644
--- a/includes/FooterHooks.php
+++ b/includes/FooterHooks.php
@@ -89,7 +89,6 @@
 * to the output when:
 *
 * 
-*   $wgRelatedArticlesShowInFooter is truthy
 *   On mobile, the output is being rendered with
 * SkinMinervaBeta
 *   The page is in mainspace
@@ -105,15 +104,10 @@
 * @return bool Always true
 */
public static function onBeforePageDisplay( OutputPage $out, Skin $skin 
) {
-   $config = MediaWikiServices::getInstance()->getConfigFactory()
-   ->makeConfig( 'RelatedArticles' );
-   $showReadMore = $config->get( 'RelatedArticlesShowInFooter' );
-
$title = $out->getContext()->getTitle();
$action = $out->getRequest()->getText( 'action', 'view' );
 
if (
-   $showReadMore &&
$title->inNamespace( NS_MAIN ) &&
// T120735
$action === 'view' &&
diff --git a/includes/SidebarHooks.php b/includes/SidebarHooks.php
deleted file mode 100644
index 2b73e74..000
--- a/includes/SidebarHooks.php
+++ /dev/null
@@ -1,116 +0,0 @@
-SidebarBeforeOutput hook.
-*
-* Retrieves the list of related pages
-* and adds its HTML representation to the sidebar if the ReadMore 
feature
-* is disabled and the beta feature is enabled by the user.
-*
-* @param Skin $skin Skin object
-* 

[MediaWiki-commits] [Gerrit] mediawiki...RelatedArticles[master]: Breaking change: Remove Sidebar code from RelatedArticles

2017-05-25 Thread Jdlrobson (Code Review)
Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/355637 )

Change subject: Breaking change: Remove Sidebar code from RelatedArticles
..

Breaking change: Remove Sidebar code from RelatedArticles

RelatedArticles will now only render related articles in the footer of
skins.

Bump version to 3.0.0

Bug: T165991
Change-Id: Ia4e28c0ed76b3aff37c0aea8eb713923312ba23c
---
M extension.json
M includes/FooterHooks.php
D includes/SidebarHooks.php
M tests/browser/LocalSettings.php
4 files changed, 1 insertion(+), 125 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RelatedArticles 
refs/changes/37/355637/1

diff --git a/extension.json b/extension.json
index 3532abf..1a0af3e 100644
--- a/extension.json
+++ b/extension.json
@@ -13,7 +13,6 @@
"type": "betafeatures",
"AutoloadClasses": {
"RelatedArticles\\Hooks": "includes/Hooks.php",
-   "RelatedArticles\\SidebarHooks": "includes/SidebarHooks.php",
"RelatedArticles\\FooterHooks": "includes/FooterHooks.php"
},
"ExtensionMessagesFiles": {
@@ -120,8 +119,6 @@
"config": {
"@RelatedArticlesLimit": "Maximum number of articles that 
should be shown in RelatedArticles widget. When set to false no upper limit",
"RelatedArticlesLimit": 3,
-   "RelatedArticlesShowInSidebar": true,
-   "RelatedArticlesShowInFooter": false,
"RelatedArticlesUseCirrusSearch": false,
"RelatedArticlesOnlyUseCirrusSearch": false,
"RelatedArticlesLoggingSamplingRate": 0.01,
diff --git a/includes/FooterHooks.php b/includes/FooterHooks.php
index 097989c..bd4446c 100644
--- a/includes/FooterHooks.php
+++ b/includes/FooterHooks.php
@@ -21,7 +21,7 @@
 *
 * @param array $vars
 * @param OutputPage $out
-* @return boolean Always true
+* @return boolean Always trueincludes/FooterHooks.php
 */
public static function onMakeGlobalVariablesScript( &$vars, OutputPage 
$out ) {
$config = MediaWikiServices::getInstance()->getConfigFactory()
@@ -90,7 +90,6 @@
 * to the output when:
 *
 * 
-*   $wgRelatedArticlesShowInFooter is truthy
 *   On mobile, the output is being rendered with
 * SkinMinervaBeta
 *   The page is in mainspace
@@ -108,13 +107,11 @@
public static function onBeforePageDisplay( OutputPage $out, Skin $skin 
) {
$config = MediaWikiServices::getInstance()->getConfigFactory()
->makeConfig( 'RelatedArticles' );
-   $showReadMore = $config->get( 'RelatedArticlesShowInFooter' );
 
$title = $out->getContext()->getTitle();
$action = $out->getRequest()->getText( 'action', 'view' );
 
if (
-   $showReadMore &&
$title->inNamespace( NS_MAIN ) &&
// T120735
$action === 'view' &&
diff --git a/includes/SidebarHooks.php b/includes/SidebarHooks.php
deleted file mode 100644
index ec7b622..000
--- a/includes/SidebarHooks.php
+++ /dev/null
@@ -1,116 +0,0 @@
-SidebarBeforeOutput hook.
-*
-* Retrieves the list of related pages
-* and adds its HTML representation to the sidebar if the ReadMore 
feature
-* is disabled and the beta feature is enabled by the user.
-*
-* @param Skin $skin
-* @param array $bar
-* @return boolean Always true
-*/
-   public static function onSidebarBeforeOutput( Skin $skin, &$bar ) {
-   $out = $skin->getOutput();
-   $relatedPages = $out->getProperty( 'RelatedArticles' );
-
-   if ( !self::isInSidebar( $relatedPages, $out->getUser() ) ) {
-   return true;
-   }
-
-   $relatedPagesUrls = self::getRelatedPagesUrls( $relatedPages );
-
-   // build relatedarticles 's
-   $relatedPages = [];
-   foreach ( (array) $relatedPagesUrls as $url ) {
-   $relatedPages[] =
-   Html::rawElement( 'li', [ 'class' => 
htmlspecialchars( $url['class'] ) ],
-   Html::element( 'a', [ 'href' => 
htmlspecialchars( $url['href'] ) ],
-   $url['text']
-   )
-   );
-   }
-
-   // build complete html
-   $bar[$skin->msg( 'relatedarticles-title' )->text()] =
-   Html::rawElement( 'ul', [],
-   implode( '', $relatedPages )
-   );
-
-   return true;
-   }
-
-   /**
-* Generates