Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/143363
Change subject: Avoid empty namespace section on Special:EditWatchlist ...................................................................... Avoid empty namespace section on Special:EditWatchlist When the database contains a title for a positive namespace which is no longer activ, a toc item and a empty section is shown on Special:EditWatchlist. After reload the section is gone, because the database was cleaned up and the invalid namespace no longer can produce the section. Refactor a bit to avoid the empty section also on the first view to get a stable output of that special page. Change-Id: I41426bde71b21a4abddb12af0b3a84931f51ac97 --- M includes/specials/SpecialEditWatchlist.php 1 file changed, 11 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/63/143363/1 diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index 369f11f..e0c1f01 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -538,23 +538,26 @@ $count = 0; foreach ( $this->getWatchlistInfo() as $namespace => $pages ) { - if ( $namespace >= 0 ) { - $fields['TitlesNs' . $namespace] = array( - 'class' => 'EditWatchlistCheckboxSeriesField', - 'options' => array(), - 'section' => "ns$namespace", - ); - } + $options = array(); foreach ( array_keys( $pages ) as $dbkey ) { $title = Title::makeTitleSafe( $namespace, $dbkey ); if ( $this->checkTitle( $title, $namespace, $dbkey ) ) { $text = $this->buildRemoveLine( $title ); - $fields['TitlesNs' . $namespace]['options'][$text] = $title->getPrefixedText(); + $options[$text] = $title->getPrefixedText(); $count++; } } + + // checkTitle can filter some options out, which can result in a empty section + if ( count( $options ) > 0 ) { + $fields['TitlesNs' . $namespace] = array( + 'class' => 'EditWatchlistCheckboxSeriesField', + 'options' => $options, + 'section' => "ns$namespace", + ); + } } $this->cleanupWatchlist(); -- To view, visit https://gerrit.wikimedia.org/r/143363 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I41426bde71b21a4abddb12af0b3a84931f51ac97 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits