Hoo man has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/337223 )
Change subject: Fix omitted/ invalid entity id handling in Special:AboutTopic
......................................................................
Fix omitted/ invalid entity id handling in Special:AboutTopic
Don't pass the empty string to the ItemId constructor, but
just use the standard robot policy.
Bug: T157865
Change-Id: I3c39bfca3eedfdeea70d62787c2b07d861787dc3
---
M includes/specials/SpecialAboutTopic.php
M tests/phpunit/includes/specials/SpecialAboutTopicTest.php
2 files changed, 19 insertions(+), 4 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ArticlePlaceholder
refs/changes/23/337223/1
diff --git a/includes/specials/SpecialAboutTopic.php
b/includes/specials/SpecialAboutTopic.php
index b5bb99e..c69cbd7 100644
--- a/includes/specials/SpecialAboutTopic.php
+++ b/includes/specials/SpecialAboutTopic.php
@@ -268,13 +268,17 @@
* @return string
*/
protected function getRobotPolicy() {
+ $wikibaseItem = $this->getOutput()->getProperty(
'wikibase_item' );
+ if ( $wikibaseItem === null ) {
+ // No item id set: We're showing the form, not an
actual placeholder.
+ return parent::getRobotPolicy();
+ }
+
if ( $this->searchEngineIndexed === true ) {
return 'index,follow';
}
if ( is_string( $this->searchEngineIndexed ) ) {
- $wikibaseItem = $this->getOutput()->getProperty(
'wikibase_item' );
-
$entityId = new ItemId( $wikibaseItem );
$maxEntityId = new ItemId( $this->searchEngineIndexed );
diff --git a/tests/phpunit/includes/specials/SpecialAboutTopicTest.php
b/tests/phpunit/includes/specials/SpecialAboutTopicTest.php
index 99f0799..744105b 100644
--- a/tests/phpunit/includes/specials/SpecialAboutTopicTest.php
+++ b/tests/phpunit/includes/specials/SpecialAboutTopicTest.php
@@ -52,8 +52,19 @@
$settings->setSetting( 'siteGroup', $siteGroup );
}
- public function testHTML() {
- $output = $this->getInstanceOutput( '' );
+ public function provideSearchEngineIndexed() {
+ return [
+ [ true ],
+ [ false ],
+ [ 'Q123' ]
+ ];
+ }
+
+ /**
+ * @dataProvider provideSearchEngineIndexed
+ */
+ public function testHTML( $searchEngineIndexed ) {
+ $output = $this->getInstanceOutput( '', $searchEngineIndexed );
$this->assertSame( '(articleplaceholder-abouttopic)',
$output->getPageTitle() );
$html = $output->getHTML();
--
To view, visit https://gerrit.wikimedia.org/r/337223
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c39bfca3eedfdeea70d62787c2b07d861787dc3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ArticlePlaceholder
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits