In the mobile site of any Wikipedia (*.m.wikipedia.org) the article title is not displayed if it is "0".
Examples: https://en.m.wikipedia.org/wiki/0, https://test2.m.wikipedia.org/wiki/0
Nloveladyallen | |
Apr 16 2017, 9:31 PM |
F7583931: T163084.PNG | |
Apr 16 2017, 9:36 PM |
In the mobile site of any Wikipedia (*.m.wikipedia.org) the article title is not displayed if it is "0".
Examples: https://en.m.wikipedia.org/wiki/0, https://test2.m.wikipedia.org/wiki/0
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Show title on the page named '0' | mediawiki/skins/MinervaNeue | master | +2 -1 |
Here's a screenshot of what the task is talking about.
On left, there is no Article Title "Heading" shown (en.m.wikipedia.org/wiki/0). On right, there is an Article Title "Heading" shown (en.m.wikipedia.org/wiki/Human)
Typical php pitfall:
Looing at SkinMinerva::getHeadingHtml:
$pageTitle = $this->getOutput()->getPageTitle(); if ( $pageTitle ) { $heading = $pageTitle; }
I haven't sent this in as a patch because I'm not sure why the if( $pageTitle ) was added in the first place - hence I don't know whether removing it might be harmful to some other edge case. Should we go with just removing the if or exclude this edge case with if( $pageTitle || $pageTitle === '0' )?
@EddieGP
Vector also expects that title's might not be present.
// Loose comparison with '!=' is intentional, to catch null and false too, but not '0' if ( $this->data['title'] != '' ) { ?> <h1 id="firstHeading" class="firstHeading" lang="<?php $this->text( 'pageLanguage' ); ?>"><?php $this->html( 'title' ) ?></h1> <?php } ?>
Change 368585 had a related patch set uploaded (by EddieGP; owner: EddieGP):
[mediawiki/skins/MinervaNeue@master] Show title on the page named '0'
Thanks @TheDJ, that snippet (especially with the comment given there) convinced me that this check exists on purpose. ;-) Hence I've used the same comparison as Vector did (and re-used the comment from there, sums it up quite nicely).
Bringing this patch as unplanned sprint work to our current sprint. @EddieGP wrote fix and it works nicely. @ovasileva could you verify and signoff this task?
Change 368585 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Show title on the page named '0'
I can verify this as it's a technical task. Thanks @EddieGP you fixed it! Well done and thank you! :D